I do a HTML app registration screen, when using ajax import data into the database has a problem,
The following part for HTML code:
The function tijiao () {
Var password=document. GetElementById (" password "). The value;
Var password2=document. GetElementById (' password2). The value;
Var username=document. GetElementById (" username "). The value;
If (password=='| | password2==' | | username==' ') {
Alert (" please enter the username and password)
} else if (password! Password2)={
Alert (' two passwords don't match, re-enter ~ ')
} else {
API. Ajax ({
Url: http://localhost/app/app/register.php? The username='+ username + & amp; Password='+ password,//DISCUZ PHP query statements, output in JSON
DataType: 'json'
{} function (ret, err)
Alert (' registration ');
});
}
}
Url path is one hundred percent correct, PHP file browser with direct access to insert the data can be successful (for example: http://localhost/app/app/register.php? The username=www& Password=123, directly in the browser to access can be inserted into success), is to use HTML ajax inserted, but registered successful play window can trigger, tried to use each place, bosses to help (I am using apicloud written app)
CodePudding user response:
If the dataType of the types of data format and back-end response do not match the requirementsCodePudding user response:
Cross-domain problem? 404? What is 504?404 that's wrong path
504, that is your request data processing is not consistent with the front end, is the way of the back-end to accept data, and the front end request does not match the data
CodePudding user response:
API. Ajax? The console and see you wrongCodePudding user response:
DataType: 'json'Change the dataType: 'text'
Have a try
CodePudding user response:
F12 developer tools - network, submitted tracking to see whether the data and the data returned to normal,