Sunday, November 30, 2008

[jQuery] Re: getJSON doesn't run the function inside

hi again,

ok, i'm answering to my self:
$.getJSON failed silently cuz the json response was not well written in the php script.

Indeed, i used the json_encode php function which was not available in my php conf.

regards,

f.

2008/11/30 fabrice.regnier <fabrice.regnier@gmail.com>
Hi all ;)

I'm very new to jquery.

I'm playing with JSON and have some prob to retrieve the result.

Here is the client side:
<script>
$(document).ready(function(){
       $("#IdEmailField").blur(function(){
              alert("FOO1"); --> it works
               $.getJSON("test.php", function(json){
                       alert("FOO2"); --> it doesn't work
               });
       });
});
</script>

Here is the server side:
<?php
echo "foo";
?>

It seems it doesn't go inside the function. Any idea ?

regards,

f.

No comments: