The ajax request code is as follows: php processing part: Firefox firebug: why can't I print it ???
The ajax request code is as follows:
Php processing:
Firefox firebug:
Why ???
Reply content:
The ajax request code is as follows:
Php processing:
Firefox firebug:
Why ???
I prefer to use it directly.$.post(settings)(Actually prefer direct$.ajax(url, settings). Callback passed$.post()Or$.ajax()The returned promisedone()So that the structure is clear.
$. Post ({url: theurl, dataType: "json", data: {tablename: _ tbname }}). done (function (jo) {// jo is a javascript object // JSON returned from the backend is parsed to the console. log (jo );});
In your way, you can add a parameter "json" after callback to represent the data type.
$.post("http://url/", { tablename: _tbname}, function(data) {}, "json");
Json_encode ($ data, JSON_UNESCAPED_UNICODE)
No error is reported. restart firefox.
PS: Set the response header @ header ("Content-Type: application/json; charset = utf8 ");
Var json = eval (data) can be omitted.
Additionally, it is not safe to use eval. we recommend that you use
var json = jQuery.parseJSON(data);
For chrome (I am really not used to debugging Firefox, so if you are used to it), breakpoint debugging is mostly not implemented. I haven't used Firefox for a long time. I vaguely remember that there were similar problems in the past. This should have been an error in chrome, and there is no error in Firefox. Let's take a look at the breakpoint first. if there is no way to access it, try chrome.
By default, the returned data is a string instead of a json object. Solution 1: specify the return type as json in the request parameters, and parse jquery into an object. Solution 2, deserialize json strings into objects. Example: http://blog.163.com/m13864039...