On Monday, May 19, 2014 4:55:17 AM UTC-7, Santosh Shingare wrote:
> Dear all,
>
>
>
> I am trying to getting responses from server using ajax. it executing well in
> browser, but not for app. can any one help me.
>
>
>
> Thank you
Hello Nilay and Jason,
Thank you for your reply, but still facing problem.
My problem is I not getting ajax responses, in my code. its blank
Ajax code :-
var xhr = new XMLHttpRequest({mozSystem: true});
xhr.open("GET", "http://localhost/FxPHP/getcources.php", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
obj = JSON.parse(xhr.responseText);
$("#searchResults").html("<strong>Santosh "+obj.name+"
"+obj1.cname+"</strong>");
}
}
xhr.send();
PHP Code:-
$sql=mysql_query("SELECT cid,cname from course where deptid=1");
while($row=mysql_fetch_array($sql))
{
$title=$row['cid'];
$url=$row['cname'];
echo ' {"cid":"'.$row["cid"].'","cname":"'.$row["cname"].'"},'; }
Response in browser :-
{ "cid":"2", "cname":"Aerodynamics of Compressors and Turbines" },
Can you help me whats wrong with my code.
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g