Home > Back-end >  Ajax from the background to the data output is empty
Ajax from the background to the data output is empty

Time:10-04



Here is the front desk of the console output respectively, the background return statement, the foreground of js

Here background debug debugging when can I see the data is some, but returned to the front desk with the console. The log () output is, is empty, solving

CodePudding user response:

Taiwan before and after the data type is not the same! Background return should be converted to a JSON object, front desk value can be directly

CodePudding user response:

Don't turn you direct print data, first take a look at the background to return to the original data, so no words, may be the cause of the background

CodePudding user response:

Look at the ajax requests in the network under the return value will be know

CodePudding user response:

First take a look at the data transfer in no and return that add @ RespondBody json annotation

CodePudding user response:

DataType: 'json' query correctly if the background and can return to normal, ajax try to modify the data type

CodePudding user response:

Sweat, tools don't use,
Your screenshot, click on the Network, find you initiate the request, take a look at the response data flow is what

CodePudding user response:

DataType: "json"
Returns the data type of the set to json
  • Related