How can I register multiple accounts on the same mobile phone using the javascript-AJAX submission form?

Source: Internet
Author: User
{Code...} Mainly uses ajax, jquery, and jqueryform.
// Submit the form $ ('# btn-confirm-login '). on ('click', function () {$ ('# form-to-post '). ajaxSubmit ({beforeSubmit: function () {if ($ ('# input-account '). val (). length = 0) {ui. error ("enter an account"); $ ('# input-account '). focus (); return false;} if ($ ('# input-password '). val (). length = 0) {ui. error ("Enter password"); $ ('# pinput-password '). focus (); return false;} return true;}, success: function (I) {detail ('assumerror-msg-tip'detail .html ('

'+ I .info +'

'). Show (); if (I. status = 1) {if (I. data = 0) {window. location. href = U ('Public/Index/Index');} else {window. location. href = I. data ;}} else if (I. status = 2) {var membs = I. data; // console. log (membs); var $ con =$ ('# select-sub-acc'); $ con. empty (); $. each (membs, function (I, e) {var $ btn = $ (""); $ Btn. text (e. uname ). data ("acc", e. worket ). data ('uid', e. uid); $ btn. on ('click', function () {// var worket = $ (this ). data ('Acc '); var uid = $ (this ). data ('uid'); $ ('# hidden-uid '). val (uid); // $ ('# input-account '). val (worket); $ ('# btn-confirm-login '). trigger ('click');}); $ con. append ($ btn) ;}); var $ dialog =$ ('# select-sub-acc '). dialog ({autoOpen: false, height: 200, width: 300, modal: true, title: "Please confirm an account"}); $ dialog. dialog ('open') ;}}, dataType: 'json'}); return true ;}); // var j17 =17. noConflict ();
When you register multiple accounts on the same mobile phone, you will be reminded of which account to log on to. For example, here, the names of different uname accounts are displayed. If you want to change to a name (identity) school, the school and the name are in the same table, and the identity is in another table, how can you write it? How can I write the brackets for identity?

Here we mainly use ajax, jquery, and jquery form.

Reply content:
// Submit the form $ ('# btn-confirm-login '). on ('click', function () {$ ('# form-to-post '). ajaxSubmit ({beforeSubmit: function () {if ($ ('# input-account '). val (). length = 0) {ui. error ("enter an account"); $ ('# input-account '). focus (); return false;} if ($ ('# input-password '). val (). length = 0) {ui. error ("Enter password"); $ ('# pinput-password '). focus (); return false;} return true;}, success: function (I) {detail ('assumerror-msg-tip'detail .html ('

'+ I .info +'

'). Show (); if (I. status = 1) {if (I. data = 0) {window. location. href = U ('Public/Index/Index');} else {window. location. href = I. data ;}} else if (I. status = 2) {var membs = I. data; // console. log (membs); var $ con =$ ('# select-sub-acc'); $ con. empty (); $. each (membs, function (I, e) {var $ btn = $ (""); $ Btn. text (e. uname ). data ("acc", e. worket ). data ('uid', e. uid); $ btn. on ('click', function () {// var worket = $ (this ). data ('Acc '); var uid = $ (this ). data ('uid'); $ ('# hidden-uid '). val (uid); // $ ('# input-account '). val (worket); $ ('# btn-confirm-login '). trigger ('click');}); $ con. append ($ btn) ;}); var $ dialog =$ ('# select-sub-acc '). dialog ({autoOpen: false, height: 200, width: 300, modal: true, title: "Please confirm an account"}); $ dialog. dialog ('open') ;}}, dataType: 'json'}); return true ;}); // var j17 =17. noConflict ();
When you register multiple accounts on the same mobile phone, you will be reminded of which account to log on to. For example, here, the names of different uname accounts are displayed. If you want to change to a name (identity) school, the school and the name are in the same table, and the identity is in another table, how can you write it? How can I write the brackets for identity?

Here we mainly use ajax, jquery, and jquery form.

I used ajax and assembled the data and sent it to me. Why do I stick to a form?

If JQuery and Ajax are used, use this code.
`
$ ('# Btn-confirm-login'). on ('click', function (){

$. Ajax ({beforeSend: function () {if ($ ('# input-account '). val (). length = 0) {ui. error ("enter an account"); $ ('# input-account '). focus (); return false;} if ($ ('# input-password '). val (). length = 0) {ui. error ("Enter password"); $ ('# pinput-password '). focus (); return false;} return true;}, dataType: "json", data: {"user": user, "pwsd": pwsd}, success: function (I) {detail ('assumerror-msg-tip'detail .html ('

'+ I .info +'

'). Show (); if (I. status = 1) {if (I. data = 0) {window. location. href = U ('Public/Index/Index');} else {window. location. href = I. data ;}} else if (I. status = 2) {var membs = I. data;

// Console. log (membs );

Var $ con = $ ('# select-sub-acc'); $ con. empty (); $. each (membs, function (I, e) {var $ btn = $ (""); $ Btn. text (e. uname ). data ("acc", e. worket ). data ('uid', e. uid); $ btn. on ('click', function () {// var worket = $ (this ). data ('Acc '); var uid = $ (this ). data ('uid'); $ ('# hidden-uid '). val (uid); // $ ('# input-account '). val (worket); $ ('# btn-confirm-login '). trigger ('click');}); $ con. append ($ btn) ;}); var $ dialog =$ ('# select-sub-acc '). dialog ({autoOpen: false, height: 200, width: 300, modal: true, title: "Please confirm an account"}); $ dialog. dialog ('open ');}}});

`

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.