Answer the question
In order to leave comments, you need to log in
jQuery post json why no response?
1.php
var arr = {"token":"123"};
$.ajax({
url: '2.js',
type: 'POST',
data: JSON.stringify(arr),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
//async: false,
success: function (r) {
console.log('res');
console.log(r);
}
});
/*xxx*/{"result":"1000"}/*xxx*/
Answer the question
In order to leave comments, you need to log in
dataFilter: function(response) {
return response.replace("/*xxx*/","").replace("/*xxx*/","");
},
as far as I understand, your POST request is not processed by the server? It just returns the contents of 2.js
And most likely the server is doing everything right, and your only problem is that /*xxx*/{"result":"1000"}/*xxx*/
- is not a valid JSON.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question