Click here to Skip to main content
15,888,454 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Angular Js, MongoDB, Javascript Pin
Member 1166176426-May-15 18:44
Member 1166176426-May-15 18:44 
QuestionRe: Angular Js, MongoDB, Javascript Pin
Richard MacCutchan26-May-15 21:55
mveRichard MacCutchan26-May-15 21:55 
AnswerRe: Angular Js, MongoDB, Javascript Pin
Member 1166176426-May-15 22:20
Member 1166176426-May-15 22:20 
GeneralRe: Angular Js, MongoDB, Javascript Pin
Richard MacCutchan26-May-15 23:27
mveRichard MacCutchan26-May-15 23:27 
GeneralRe: Angular Js, MongoDB, Javascript Pin
Member 1166176427-May-15 0:38
Member 1166176427-May-15 0:38 
GeneralRe: Angular Js, MongoDB, Javascript Pin
Richard MacCutchan26-May-15 23:30
mveRichard MacCutchan26-May-15 23:30 
AnswerRe: Angular Js, MongoDB, Javascript Pin
ZurdoDev27-May-15 2:05
professionalZurdoDev27-May-15 2:05 
QuestionDisplay value from database in jvector Map Pin
Member 1127102925-May-15 0:26
professionalMember 1127102925-May-15 0:26 
i have used Jvector Map.its display country from default. i have created simple database and connected jquery ajax my database value using only alert only. but i want display database value when i click country.

Here attach my code:

JavaScript
    jQuery.noConflict();
    jQuery(function(){
      var $ = jQuery;
      $('#focus-single').click(function(){
        $('#map1').vectorMap('set', 'focus', {region: 'AU', animate: true});
      });
      $('#focus-multiple').click(function(){
        $('#map1').vectorMap('set', 'focus', {regions: ['AU', 'JP'], animate: true});
      });
      $('#focus-coords').click(function(){
        $('#map1').vectorMap('set', 'focus', {scale: 7, lat: 35, lng: 33, animate: true});
      });
      $('#focus-init').click(function(){
        $('#map1').vectorMap('set', 'focus', {scale: 1, x: 0.5, y: 0.5, animate: true});
      });
      $('#map1').vectorMap({
        map: 'world_mill_en',
        panOnDrag: true,
        focusOn: {
          x: 0.5,
          y: 0.5,
          scale: 1,
          animate: true
        },
        series: {
          regions: [{
            scale: ['#688FA0'],
            normalizeFunction: 'polynomial',
            values: {
             
              //"DZ": 158.97,
             // "AZ":1.1,
              "AG": 1.1,
			 // "AE":7.54,
			 // "AO":5.6,
              "AR": 351.02,
              //"AM":3.96,
              "AU": 1219.72,
              "AT": 366.26,
              //"AF":3.96,
			 // "AL":3.96,
              //"BS": 7.54,
              
			    
            }
          }]
        },
		onRegionClick: function (event, code) {
        var map = $('#map1').vectorMap('get', 'mapObject');
        var name = map.getRegionName(code);
	/* 
	onRegionLabelShow: function(e, el, code) {
    //search through data to find the selected country by it's code
    var country = $.grep(data.countries, function(obj, index) {
    return obj.code == code;
    })[0]; //snag the first one
    if (country != undefined) {
        el.html(el.html() + "<br/>Code: " +country.code + "<br/>Continent :  " + country.continent);
    }
	  */
		 	
		// get from DB using ajax

	$(document ).ready(function() {
$.ajax({
    type: "GET",
    url: 'database.php',

	data: {country: name},
	dataType: "text",
    success: function(data){
      alert(data);
		
    }
});
	});
		
},
      });
    })
	
	

</script>




database code:

<pre><pre><pre lang="PHP">
connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT countryId,country,pdogcoregion,ccl,category FROM countrydetails WHERE country='".$_country."'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "country: " . $row["country"];
}
}
else {
echo "No database";
}

$conn->close();
?>

Its showing country from default not from database .database value only show alert..how to change to click?
QuestionHow to read UI element value using jQuery (context vs find) ? Pin
Anjum.Rizwi25-May-15 0:03
professionalAnjum.Rizwi25-May-15 0:03 
AnswerRe: How to read UI element value using jQuery (context vs find) ? Pin
Libin Emmanuel25-May-15 2:07
Libin Emmanuel25-May-15 2:07 
AnswerRe: How to read UI element value using jQuery (context vs find) ? Pin
Richard Deeming27-May-15 2:22
mveRichard Deeming27-May-15 2:22 
QuestionHow to call ajax in php databse file in jvector map? Pin
Member 1127102920-May-15 1:49
professionalMember 1127102920-May-15 1:49 
QuestionRe: How to call ajax in php databse file in jvector map? Pin
ZurdoDev20-May-15 8:56
professionalZurdoDev20-May-15 8:56 
QuestionjQuery validates all required fields except file upload. Pin
samflex19-May-15 8:29
samflex19-May-15 8:29 
AnswerRe: jQuery validates all required fields except file upload. Pin
ZurdoDev20-May-15 8:56
professionalZurdoDev20-May-15 8:56 
GeneralRe: jQuery validates all required fields except file upload. Pin
samflex21-May-15 2:40
samflex21-May-15 2:40 
GeneralRe: jQuery validates all required fields except file upload. Pin
Richard Deeming21-May-15 5:51
mveRichard Deeming21-May-15 5:51 
QuestionHow to pass image in javascript? Pin
Shän Yü18-May-15 2:56
Shän Yü18-May-15 2:56 
QuestionRe: How to pass image in javascript? Pin
2Programmer7829-May-15 11:38
2Programmer7829-May-15 11:38 
QuestionBase64 string corrupted or truncated Pin
JeganMaria18-May-15 0:51
JeganMaria18-May-15 0:51 
Questiondesign a game Pin
Member 116724807-May-15 9:17
Member 116724807-May-15 9:17 
AnswerRe: design a game Pin
ZurdoDev7-May-15 9:22
professionalZurdoDev7-May-15 9:22 
Questiondesign a game Pin
Member 116724807-May-15 9:15
Member 116724807-May-15 9:15 
AnswerRe: design a game Pin
ZurdoDev7-May-15 9:23
professionalZurdoDev7-May-15 9:23 
JokeRe: design a game Pin
CodeReady7-May-15 21:32
CodeReady7-May-15 21:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.