The function corresponding to the registration page cannot get the value of the text control. The function corresponding to the registration page is:
$.post('{:U("Register/register")}', $('#register'), function(str) { // .serialize()
RegisterAction. class. php:
// Register public function register () {$ data ['U _ username'] = strtolower (I ('name', '', 'trim ')); $ data ['U _ phone'] = I ('phone', '', 'trim'); $ data ['U _ email '] = I ('email ', '', 'trim'); $ data ['U _ password'] = I ('pass'); $ data ['repassword'] = I ('rpass '); $ rpass = I ('rpass ');......
The values obtained from these variables are empty. why?
In the register template file,
if (email === 0 || phone === 0 || code === 0 || username === 0 || password === 0 || rpassword === 0) {...
The values of these email and other variables are all 0.
if (document.getElementById("email").value === 0 || document.getElementById("phone").value === 0 || document.getElementById("code").value === 0 || document.getElementById("username").value === 0 || document.getElementById("password").value === 0 || document.getElementById("rpassword").value === 0) {
In this way, the values of various text box controls are obtained.
Text box code:
Reply to discussion (solution)
If register is the form id
So
$. Post ('{: U ("Register/register")}', $ ('# register '). serialize (), function (str ){.......
It's a THINKPHP framework project!
If register is the form id
So
$. Post ('{: U ("Register/register")}', $ ('# register '). serialize (), function (str ){.......
Thank you for your reply! The strange thing is that you didn't execute RegisterAction. class. php's register!
Why?
Other similar ajax triggers. Why can't this AJAX be triggered? Think twice!
The above is not correct. AJAX is triggered, and this strange string is returned. I don't know where it comes from: {"info ": "\ u9a8c \ u8bc1 \ u7801 \ u8f93 \ u5165 \ u9519 \ u8bef! "," Status ": 0," url ":""}
It should return 1 or "registration failed. please try again !" That's right! Strange!
If ($ status & $ status2 & $ status1 & $ status3) {$ m-> commit (); unset ($ _ SESSION ['thirdpartyuserid']); unset ($ _ SESSION ['thrid _ party_type ']); $ _ SESSION ['uname'] = $ data ['U _ username']; die ("1") ;}else {$ m-> rollback (); die ("registration failed, please try again! ");}
Print_r (json_decode ('{"info": "\ u9a8c \ u8bc1 \ u7801 \ u8f93 \ u5165 \ u9519 \ u8bef! "," Status ": 0," url ":""}'));
StdClass Object
(
[Info] => incorrect verification code!
[Status] => 0
[Url] =>
)
You didn't follow the rules!