jquery - Zend Json_Encode and .getJson success not being called? -
I have a script that I am using to return some JSON back to PHP using Zed Framework .
This is what I am getting back to: [] {"Test": "Tester"} But in jQuery the success function is not being called. Should be Json [{"Test": "Tester"}]?
I did this in my controller:
echo Zend_Json :: encode (array ("test" => "tester")); Client JS:
$ .getJSON ("/ entry / get-project", {"id": 1, "format": " Jason "}, function (data, textstats, jxxhr) {alert (" win ");});
In your action dealing with Jason Call
$ Callback = $ this- & gt; GetRequest () - & gt; GetParam ('callback'); Resonance $ callback '(' .Zend_Json :: encode (array '' '='> 'value')). '' '; In your JS < / Pre>
Not so, you can always try:
http://php.net/manual/en/function.json-encode.php Echo json_encode (array ('Key' = & gt; 'value'));
Comments
Post a Comment