Dear All I am using JQuery & javascript PHP, My Ajax.php just displays the data ,test.php has assigns the value to javascript function. My Problem is I not able to get the values that assigned by test.php, from getList(data). is Any wrong in my logic ?.What to do to get the values assigned by test.php will be displayed in getList() function?
$.ajax({
type:'POST',
url: 'ajax.php',
data:'id='+id ,
success: function(data){
$("#response").html(data);
if(flag!=0){
flag=0;
$.get("test.php", function(data){
alert("Data Loaded: " + data);
getList(data);
});
}
}//success
}); //ajax
And test.php has following
<?php
print "<script language='javascript'>";
print " temp[temp.length]=new Array('STA-VES','East',4500);";
print " temp[temp.length]=new Array('STA-CRF','West',5400);";
print "</script>";
?>
My Javascript function has
var temp=new Array();
getList(){
alert(temp.length);
for(var i=0; i<temp.length; i++){
var val = temp[i];
}
}
Any Idea?