One, cannot modify
Details: Every time you perform a modification, "error code ..." is always displayed.
Workaround: When the error is found, the code executes to success, and enters to else when judging the if (Data.resultcode==getoption ("resultcode_success)") conditional statement. Output Data.resultcode and GetOption ("Resultcode_success") with alert () respectively, with the result of success and 0 respectively.
Also use $ ("#submenu_info"). HTML (fullurl), the discovery page displays the data in "ResultCode": success, because notifies the Java programmer to let him set the ResultCode result to 0 in the background.
Modify the section code as follows:
Modal.find (' form '). On (' Submit ', function (EV) {ev.preventdefault (); params["Plan_name"]=enuri ($ ("#plan_name"). Val ());p arams["description"]=enuri ($ ("#description"). Val ());p arams[" Organization "]=json.parse ($ (" #o_id "). Val ());p arams[" Layout "]=json.parse ($ (" #l_id "). Val ());p arams[" Animate "]= Json.parse ($ ("#animates"). Val ());p arams["Display_time"]=$ ("#display_time"). Val ();p arams["Layout"].viewitems= null;params["Flag"]=1;params=json.stringify (params);//params=params.replace (/\\/g, '); var fullurl=getoption ("Gykj_host") +type+ "/edit" + "?" +getoption ("Gykj_callbackparam") + "=" +getoption ("Gykj_callbackfunc") + "&token=" +getstorage ("token") + "&" + Type+ "=" +params;$ ("#submenu_info"). HTML (fullurl); $.ajax ({url:fullurl,type: ' Get ', DataType: ' Jsonp ', Jsonp: GetOption ("Gykj_callbackparam"), Jsonpcallback:getoption ("Gykj_callbackfunc"), Async:false,error:function () { Alert ("Modify:" +getoption ("Connectionerrormessage")),},success:function (data) {if (Data.resultcode==getoption (" Resultcode_success ")) {alert (data.message); sEtlisttable (nowpage);} Else{alert ("Error code" +data.errorcode+ ":" +data.message); setlisttable (nowpage);}}); /ajax modal.remove ();}); /submit
Two: Unable to delete
Details: After confirming the deletion, always display the delete unsuccessful information. Indicates that error was performed
Solution: In a show Mo sorrow, colleague A word reminds me, since can edit, certainly can delete, you separately output edit code data and delete code data, see what is different.
So I insert $ ("#submenu_info") after the FullUrl address of the two functions, respectively. HTML (fullurl), code,
The Discovery editor shows the following
http://59.39.60.226:81/weather/plan/edit?callback=jsonp&token=34e59752-c53c-4b06-af56-8bf0e1271433& plan={"plan_id": 6, "plan_name": "All", "Display_time": "7", "order": null, "description": "8", "organization": {"o_id": 2, "O_name": "Organization structure name", "logo": "", "description": "Description erytreyss113"}, "layout": {"l_id": 3, "L_name": "Life Index", "L_type": null, " Picture ": null," Viewitems ": null}," animate ": {" a_id ": 2," A_name ":" Push_left "," description ":" Push_left "}," Flag ": 1}
The Delete code displays
http://59.39.60.226:81/weather/plan/edit?callback=jsonp&token=34e59752-c53c-4b06-af56-8bf0e1271433& plan={"plan_id": 6, "plan_name": "All", "Display_time": 7, "order": null, "description": "8", "organization": {"o_id": 2, "O _name ":" Organization structure name "," logo ":" "," description ":" Description erytreyss113 "}," layout ": {" l_id ": 3," L_name ":" Life Index "," L_type ": null," Picture ": null," Viewitems ": [{" vi_id ": 565," parent_id ": 563," Viewitems ": []," type ":" Linearlayout_h "," Weight ": 1," Order ": 2," Background_type ": 3," background ":" 00ff0000 "," textsize ":", "TextColor": "ffff0000", "Structure": "," Gravity ":" Center|center "," font_family ":" Yahei "," Font_style ": null," width ":" 0 "," height ":" match_parent "," Display_ Time ": 0," padding ":" (5,5,5,5) "," Margin ":" (0,0,0,0) "," filepath ":" "," filemd5 ":", "ScaleType": "", "Flag": 1, "animate ": {" a_id ": 1," A_name ":" None "," description ":" None "}},{" vi_id ": 587," parent_id ": 570," Viewitems ": []," type ":" Linearlayout_ V "," weight ": +," order ": 2," Background_type ": 3," background ":" 00ff0000 "," Textsize ":" TextColor ": ffff0000", " Structure ":" "," Gravity ":"Center|center "," font_family ":" Yahei "," Font_style ": null," width ":" 0 "," height ":" match_parent "," Display_time ": 0," Padding ":" (5,5,5,5), "margin": "(0,0,0,0)", "filepath": "", "Filemd5": "", "ScaleType": "", "Flag": 1, "animate": {"a_id" : 1, "A_name": "None", "description": "None"}},{"vi_id": 566, "parent_id": 563, "Viewitems": [], "type": "Linearlayout_h", " Weight ": 1," Order ": 3," Background_type ": 3," background ":" 00ff0000 "," Textsize ":" TextColor ":" ffff0000 "," Structure ":", "Gravity": "Center|center", "font_family": "Yahei", "Font_style": null, "width": "0", "height": "Match_ Parent "," Display_time ": 0," padding ":" (5,5,5,5) "," Margin ":" (0,0,0,0) "," filepath ":" "," Filemd5 ":" "," ScaleType ":", "Flag": 1, "animate": {"a_id": 1, "A_name": "None", "description": "None"}},{"vi_id": 606, "parent_id": 591, "Viewitems": [], " Type ":" TextView "," Weight ": 1," Order ": 1," Background_type ": 3," background ":" 00ff0000 "," Textsize ":" TextColor ":" FFFFFFFF "," Structure ":" Zhishu.data.data.3.type "," Gravity ":" Center|center "," font_family ":" Yahei "," Font_style ": NULL, "width": "Match_parent", "height ":" 0 "," Display_time ": 0," padding ":" (5,5,5,5) "," Margin ":" (0,0,0,0) "," filepath ":" "," Filemd5 ":" "," ScaleType ":" " , "flag": 1, "animate": {"a_id": 1, "A_name": "None", "description": "None"}},{"vi_id": 568, "parent_id": 564, "Viewitems": [], " Type ":" Linearlayout_h "," Weight ": 1," Order ": 1," Background_type ": 3," background ":" 781400FF "," textsize ": 30," TextColor ":" ffff0000 "," Structure ":" "," Gravity ":" Center|center "," font_family ":" Yahei "," Font_style ": null," width " : "0", "height": "match_parent", "Display_time": 0, "padding": "(5,5,5,5)", "Margin": "(0,0,0,0)", "filepath": "", " Filemd5 ":", "ScaleType": "", "Flag": 1, "animate": {"a_id": 1, "A_name": "None", "description": "None"}},{"vi_id": 569, "Parent_ ID ": 564," Viewitems ": []," type ":" Linearlayout_h "," Weight ": 1," Order ": 2," Background_type ": 3," background ":" 781400FF "," Textsize ":" TextColor ":" ffff0000 "," Structure ":" "," Gravity ":" Center|center "," font_family ":" Yahei "," Font_ Style ": null," width ":" 0 "," height ":" match_parent "," Display_time ": 0," padding ":" (5,5,5,5) "," Margin ":" (0,0,0,0) "," FilePath ":", "FILEMD5": "", "ScaleType ":", "Flag": 1, "animate": {"a_id": 1, "A_name": "None", "description": "None"}},{"vi_id": 585, "parent_id": 568, " Viewitems ": []," type ":" Linearlayout_v "," weight ": +," order ": 2," Background_type ": 3," background ":" 00ff0000 "," Textsize ":", "TextColor": "ffff0000", "Structure": "", "Gravity": "Center|center", "font_family": "Yahei", "Font_style ": null," width ":" 0 "," height ":" match_parent "," Display_time ": 0," padding ":" (5,5,5,5) "," Margin ":" (0,0,0,0) "," FilePath ":", "FILEMD5": "", "ScaleType": "", "Flag": 1, "animate": {"a_id": 1, "A_name": "None", "description": "None"}},{"vi_id" ": 588," parent_id ": 571," Viewitems ": []," type ":" Linearlayout_v "," weight ": +," order ": 2," Background_type ": 3," Background ":" 00ff0000 "," textsize ": +," TextColor ":" ffff0000 "," Structure ":", "Gravity": "Center|center", "Font_ Family ":" Yahei "," Font_style ": null," width ":" 0 "," height ":" match_parent "," Display_time ": 0," padding ":" (5,5,5,5) "," Margin ":" (0,0,0,0) "," filepath ":" "," Filemd5 ":" "," ScaleType ":" "," Flag ": 1," animate ": {" a_id ": 1," A_name ":" None "," Description ":" No "}},{" vi_id ": 595," Parent_id ": 585," Viewitems ": []," type ":" TextView "," Weight ": 1," Order ": 2," Background_type ": 3," background ":" 00ff0000 "," Textsize ":", "TextColor": "ffff0000", "Structure": "Zhishu.data.data.4.description", "Gravity": "Center|center", " Font_family ":" Yahei "," Font_style ": null," width ":" Match_parent "," height ":" 0 "," Display_time ": 0," padding ":" ( 5,5,5,5) "," Margin ":" (0,0,0,0) "," filepath ":" "," filemd5 ":", "ScaleType": "," Flag ": 1," animate ": {" a_id ": 1," A_name " : "None", "description": "None"}},{"vi_id": 599, "parent_id": 587, "Viewitems": [], "type": "TextView", "Weight": 1, "Order": 2, " Background_type ": 3," background ":" 00ff0000 "," textsize ": +," TextColor ":" FFFFFFFF "," Structure ":" Zhishu.data.data.8.description "," Gravity ":" Center|center "," font_family ":" Yahei "," Font_style ": null," width ":" Match_parent "," height ":" 0 "," Display_time ": 0," Paddi ...... "
After comparison, found that viewitems display too much data, in the editing code params["Layout"].viewitems=null;,viewitems data is null, so the code is also copied into the deletion code, the problem is resolved.
The original deletion code is as follows:
function Deleteinfo (type,item) {var params=datarecords[item];if (confirm) ("Are you sure you want to delete it?") ") {params[" flag "]=0;params=json.stringify (params), Var fullurl=getoption (" Gykj_host ") +type+"/edit "+"? " +getoption ("Gykj_callbackparam") + "=" +getoption ("Gykj_callbackfunc") + "&token=" +getstorage ("token") + "&" + Type+ "=" +params;$ ("#submenu_info"). HTML (fullurl); $.ajax ({url:fullurl,type: ' Get ', DataType: ' Jsonp ', Jsonp: GetOption ("Gykj_callbackparam"), Jsonpcallback:getoption ("Gykj_callbackfunc"), Async:false,error:function () { Alert ("Delete:" +getoption ("Connectionerrormessage")),},success:function (data) {if (Data.resultcode==getoption (" Resultcode_success ")) {//alert (data.message); setlisttable (nowpage);} Else{alert ("Error code" +data.errorcode+ ":" +data.message); setlisttable (nowpage);}});}}
Post-Modification Code
function Deleteinfo (type,item) {var params=datarecords[item];if (confirm) ("Are you sure you want to delete it?") ") {params[" layout "].viewitems=null;params[" Flag "]=0;params=json.stringify (params); var fullurl=getoption (" Gykj_ Host ") +type+"/edit "+"? " +getoption ("Gykj_callbackparam") + "=" +getoption ("Gykj_callbackfunc") + "&token=" +getstorage ("token") + "&" + Type+ "=" +params;$ ("#submenu_info"). HTML (fullurl); $.ajax ({url:fullurl,type: ' Get ', DataType: ' Jsonp ', Jsonp: GetOption ("Gykj_callbackparam"), Jsonpcallback:getoption ("Gykj_callbackfunc"), Async:false,error:function () { Alert ("Delete:" +getoption ("Connectionerrormessage")),},success:function (data) {if (Data.resultcode==getoption (" Resultcode_success ")) {//alert (data.message); setlisttable (nowpage);} Else{alert ("Error code" +data.errorcode+ ":" +data.message); setlisttable (nowpage);}});}}
Information Publishing platform (Bootstrap Ace)--$.ajax () cannot be modified or deleted