I created a new custom.js file under Public/admin/js: [Code=javascriptfunction validateusername () {
Alert (' Yes ');
$.post (
"<{:u (' index/index/users/validateusername ')}>",
{username:$ ("#UserName"). Val ()},
function (returneddata,status) {
var result=returneddata;
if (result!=null) {
$ ("#info"). HTML ("+result+");
}else{
$ ("#info"). HTML ("");
}
}
);
}][/code]
There is only one function, which is quoted in HTML:
Then use
Each call, the dialog box will appear, close the dialog box error:
Illegal operation:
Wrong location
file:c:\wamp\www\dianzi\thinkphp\common\functions.php line:112
The function of line 112 is this sentence:
function _404 ($msg = ', $url = ') { app_debug && throw_exception ($msg);
The dialog box will pop out, do not know what the reason, and then I put this JS file reference deleted, the function is written directly in the HTML:
Can be used normally, how to solve this???
Reply to discussion (solution)
You did not introduce this problem due to the introduction of the jquery library file.
Ask is which library file, jquery.js this already had, and the popup window came out the explanation already called this function, is $.post also want other file?
You did not introduce this problem due to the introduction of the jquery library file.
Ask is which library file, jquery.js this already had, and the popup window came out the explanation already called this function, is $.post also want other file?
JS placed in the file, is not the background of this method did not find: U (' Index/index/users/validateusername '), and then the background directly error
JS in this "<{:u (' index/index/users/validateusername ')}>" There is a problem oh, you this is the external introduction, TP does not seem to be a template replacement for this
The U method is not allowed to be placed directly here. I remember when I learned TP video, the teacher in the video talked about the problem. It seems like you're going to use a variable to save the URL, and then pass it over. I don't remember it.
URL to be written in the template in order to correctly parse into a routing address