This article mainly introduces jquery's information about how to use the load method to report errors after rewriting ajax and submitting and determining permissions. If you need more information, please refer to the following, paste the Code directly.
JQuery (function ($) {// back up jquery's ajax method var _ ajax =$. ajax; // rewrite the ajax method. First, judge that the success function is being executed during login $. ajax = function (opt) {var _ success = opt & opt. success | function (a, B) {}; var _ opt = $. extend (opt, {success: function (data, textStatus) {// if the background redirects the request to the logon page, the source code of the logon page is stored in data, here we need to find the evidence that data is the logon page (TAG) if (typeof data) = 'string' & data. indexOf ('shangjiaajaxextend ')! =-1) {window. location. href = 'HTTP: // '+ window. location. host + '/S/BusiLogin/Index'; return;} else {_ success (data, textStatus );}}}); return _ ajax (_ opt );};});
Rewrite principle: Because the closure function is loaded before the script on the page, you can directly rewrite $. ajax method here.
The key point is that the red part of the content must be retrun. Otherwise, the error "Uncaught TypeError: Cannot call method 'done' of undefined" is returned when loading the page using the load method ."