Submit the interface data, the interface side provides the post request, Body-raw;
I tried jquery Ajax Raw in a way that never succeeded
And then I thought I was using MUI, and I started thinking about using mui.ajax as a result, and I'm going to record it. In fact, it is also a detour, originally with MUI, the best or use it all the stuff
Code share:
1 (function () {2 3WINDOW.AX = {4Api:"HTTP://127.0.0.1/",//Here you need to replace the IP with your interface5 6 //GET Submit Method7 //U--Request Address8 //F--callback function success functions (data) {}; failure function (Xhr,type,errorthrown) {}9 g:function (u,f) {TenMui.Get(Ax.api + u,{},f,"JSON"); One }, A - //POST Submission Method - //U--Request Address the //P--Send data $ (ID) Example: "#id", {id:1} - //F--callback function success functions (data) {}; failure function (Xhr,type,errorthrown) {} - p:function (u,p,f) { - if(typeof(p) = = ="string") { +p =$ (P). SerializeObject (); - } +Mui.ajax (Ax.api +u,{ A Data:p, atDataType:'JSON', -Type'Post', -Headers: {'Content-type':'Application/json'}, - Success:f, - error:f - }); in } - } to + })(); - the //An extension to date that converts date to a string of the specified format * //the Month (m), Day (d), hour (h), Minute (m), second (s), quarter (q) can be used with 1-2 placeholders, $ //year (Y) can use 1-4 placeholders, milliseconds (S) with only 1 placeholders (1-3 digits)Panax Notoginseng //Example: - //(New Date ()). Format ("Yyyy-mm-dd hh:mm:ss. S ") ==> 2006-07-02 08:09:04.423 the //(New Date ()). Format ("yyyy-m-d h:m:s.s") ==> 2006-7-2 8:9:4.18 +Date.prototype.Format = function (FMT) {//Author:zhengsh 2016-9-5 A varo = { the "m+": This. GetMonth () +1,//Month + "d+": This. GetDate (),//Day - "H +": This. GetHours (),//hours $ "m+": This. getminutes (),//points $ "s+": This. getseconds (),//seconds - "q+": Math.floor (( This. GetMonth () +3) /3),//Quarterly - "S": This. Getmilliseconds ()//milliseconds the }; - if(/(y+)/.test (FMT)) FMT = Fmt.replace (regexp.$1, ( This. getFullYear () +""). substr (4-regexp.$1. length));Wuyi for(varKincho) the if(NewREGEXP ("("+ K +")"). Test (FMT)) FMT = Fmt.replace (regexp.$1, (regexp.$1. length = =1) ? (O[k]): (("xx"+ O[k]). substr (""+O[k] )); - returnFMT; Wu } - About //convert Form object to JSON $$.fn.serializeobject =function () { - varo = {}; - varA = This. Serializearray (); - $.each (A, function () { A if(o[ This. Name]) { + if(!o[ This. Name].push) { theo[ This. name] = [o[ This. Name]]; - } $o[ This. Name].push ( This. value | |"'); the}Else { theo[ This. Name] = This. value | |"'; the } the }); - returno; in};
MUI AJAX Raw Request data