I am creating a single page app at the initial load of the page, let me have a login form and a registration form I want to see) On login, I should see the profile page - though an empty page appears, and the URL reads: js / application.js I have also tried: js / application.js index.php Template / loginform.php In the first (application.js), the registration form and login form are loaded. On login - jquery checks that the field has content, then executes a post call for checkoline.fp script. This script does everything user needs to login. On the success of the post call - js / application.js .ready (function () {$ .get ('templates / loginform.php', function (data) {$ ('# login') .html (data); $ ("# loginform") Submit (function (e) {E.preventDefault (); if ($ ('myusername'). Val ()! = '' || $ ('# mypassword'). Val ()! = '') {$ .post ("checklog .php", $ (this) .serialize (), function () {$ ("# main"). Load ("templates / login_success.php"); $ ("# login"). (); $ ("# Registry"). Remove ();});} Other {Warning ('Please enter username / password');}});}); $ .get ('tame Template / regform.php ', function) {$ (' # Register '). Html (data);});}); I just need to verify to anyone that this is correct - I do not know the buggy code! localhost / xxx / checklogin.php . I think this means that my app is stuck on some checklogs. FTP scripts. Here are some code- so that you can understand my problem:
$ (document) .ready (function () {// load login form $ .gate ('templates / login form.fp', function (data) {$ ('# login') .html (data);}) // load registration form $ .gate ('template / regform.php' Submit the login form to $ ("# login form"), function (data) {$ ('# register') .html (data);}); Submit (function (e) {e.preventDefault () ($ ('$ Myusername'). Val ()! = '' || $ ('# mypassword'). Val ()! = '') {$ .post ("checklogin.php", $ (this) . (), (), $ ("# Login"), $ ("# Login "), function () {$ .get (" templates / login_success.php ", function (data) {$ (" # main ").); $ (" # Register "). Remove ();}); });} And {warnings ('Please enter username / password');}}};});
... $ ("# login form"). Submit (function (e) {e.preventDefault (); if ($ ('myusername'). Val ()! = '' || $ ('# mypassword'). Val ()! = '') {$ ("Checklagin.fp", $ (this) .Serialize (), function () {$ ("# main"). Load ("template / login_success.fp"); $ ("# login").) ; $ ("# Register"). Remove ();});} and {warnings ('Please enter username / password');}}); ...
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; IT & lt; / Title & gt; & Lt; Script src = "reqscripts / jquery.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "js / application.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "css / application.css" & gt; & Lt; Link href = 'http: //fonts.googleapis.com/css? Family = Londrina + Solid 'rel =' stylesheet 'type =' text / css' & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "login" & gt; & Lt; / Div & gt; & Lt; Div id = "register" & gt; & Lt; / Div & gt; & Lt; Div id = "main" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;
& lt ;? Php session_start (); ? & Gt; & Lt; Form id = "loginform" method = "post" action = "checklogin.php" & gt; & Lt; H1 class = "textaligncenter" & gt; Login & lt; / H1> & Lt; Div id = "loginuser" & gt; & Lt; Input name = "myusername" type = "text" id = "myusername" & gt; & Lt; / Div & gt; & Lt; Div id = "usertext" & gt; & Lt; P & gt; Username: & lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "loginpass" & gt; & Lt; Input name = "mypassword" type = "password" id = "mypassword" & gt; & Lt; / Div & gt; & Lt; Div id = "passtext" & gt; & Lt; P & gt; Password: & lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "submitbutton" & gt; & Lt; Input type = "submit" name = "submit" value = "login" & gt; & Lt; / Div & gt; & Lt; / Form & gt; templates / login_saves.fp is loaded into the main div, and login and registration forms are removed. As I said above, the call does not get the call before calling the application within the submission form.
$ (document) / P>
No comments:
Post a Comment