javascript - How to use jquery to decode the return json object? -
I tried to use an upload plugin for jQuery.
When I set the response type back to Jason, Firefox will pop up a dialog that I would like to handle back to the Jason object.
People have asked the same question on the upload script so far no answer on the author's page. It is expected that JavaScript people here can understand how we can handle it.
Thank you.
& lt; Script type = "text / javascript" & gt; / * & Lt ;! [CDATA [* / $ (document) .ready (function () {/ * example 1 * / var button = $ ('# button1'), interval; new azakupload (button, {// action: 'Upload-test .php ', // I have disabled uploads in this example for security examples:' / posts / upload_images / ', name:' myfile ', feedback type:' json ', permasm: function (file, ext) { // change button text, when the user selects the file button. ('Upload'); // If you want to allow to upload only 1 file on time If you are, // you can disable upload button this.disable (); // uploading - & gt; uploading - & gt; uploading ... interval = window.setInterval (function () {var Text = button.text (); if (text.length & lt; 13) {button.tex T (text + '.');} Other {button.text ('upload');}}, 200);} , But complete: function (file, response) {var json = response; warning (JSON); button.text ('upload'); window.clearInterval (interval); // Enable this button this.enable (); // list // $ (' · & gt;'). Attachment ('# example1 .files'). Text (json.response_text); $ ('& Lt; li & gt; & lt; / li & gt;'). Attachment ('# example1 .files'). text file); }}); }); / *]] & Gt; * / & Lt; / Script & gt;
var obj = jQuery.parseJSON ( '{"Name": "John"}'); Warning (obj.name === "John");
Comments
Post a Comment