Jquery creates a JSON object using a JSON string, jqueryjson
<Html> <body>
Convert the json object in jquery to a normal string
The returned value of serialize () is a string.
SerializeArray () This method returns a JSON object instead of a JSON string. You need to use plug-ins or third-party libraries for string-based operations.
In jquery1.4API, a json object is converted into a string.
Example
Description:
Obtain the Form Content and insert it into the webpage.
HTML code:
<P id = "results"> <B> Results: </B> </p>
<Form>
<Select name = "single">
<Option> Single </option>
<Option> Single2 </option>
</Select>
<Select name = "multiple" multiple = "multiple">
<Option selected = "selected"> Multiple </option>
<Option> Multiple2 </option>
<Option selected = "selected"> Multiple3 </option>
</Select> <br/>
<Input type = "checkbox" name = "check" value = "check1"/> check1
<Input type = "checkbox" name = "check" value = "check2" checked = "checked"/> check2
<Input type = "radio" name = "radio" value = "radio1" checked = "checked"/> radio1
<Input type = "radio" name = "radio" value = "radio2"/> radio2
</Form>
JQuery code:
Var fields = $ ("select,: radio"). serializeArray ();
JQuery. each (fields, function (I, field ){
$ ("# Results"). append (field. value + "");
});... The remaining full text>
How does Jquery convert an object into a json string?
");??}??}); The running result is: Failed. Please try again later! No function is redirected to the background.
I debugged jQuery. toJSON (obj) and removed it to the background function.
The data sent to the server. Will be automatically converted to the request string format. The GET request will be appended to the URL. View the description of the processData option to disable automatic conversion. The format must be "{key: Value. If it is an array, jQuery automatically corresponds to the same name for different values. For example, {foo: ["bar1", "bar2"]} is converted to '& foo = bar1 & foo = bar2 '. If the value is an Array, jQuery creates a traditional setting based on multiple consecutive values with the same key value.
You do not need to convert it here. Change your code
Data: obj. Try again.