"thinkphp" Reference js file function error, directly write function in HTML use is normal
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???
------to solve the idea----------------------
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
------to solve the idea----------------------
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.