Specific code example: JQuery works here, but I cannot figure out why

jquery , html , php Kiev, Ukraine
  • 7 years ago

    Hi, I'm having trouble understanding the principle of how JQuery is integrated with HTML forms and PHP in the specific example. Here's a link: http://www.millenniumessays.com/login.php Just enter any values and click login: on-the-fly warnings in red font are generated below the form, the page is not reloaded. I don't understand how and why it happens. I'm relatively new to JQuery and I suspect I'm missing something crucially important here. If someone could only explain how exactly the jquery code contained in index.js makes the whole thing work.

    login.php // code for login.php

    $objCore = new Core(); $objCore->initSessionInfo(); $objCore->initFormController(); if($objCore->getSessionInfo()->isLoggedIn() && $objCore->isAdmin()){ header("Location: admin.php"); }elseif($objCore->getSessionInfo()->isLoggedIn()){ header("Location: writers/available.php"); } ?> PHP Login System

    index.js // code for index.js

    $(document).ready(function() { Index.initEventHandlers(); });

    var Index = { init : function(){ }, initEventHandlers : function(){ $("#login_button").click(function(e){ Index.processSubmit(); });

    	$('.inplaceError').each(
    			fu
    
  • 7 years ago

    I guess my message here was edited/shortened somehow. that means one cannot post a lengthy examples of codes? Once again, the index.js code $(document).ready(function() { Index.initEventHandlers(); });

    var Index = { init : function(){ }, initEventHandlers : function(){ $("#login_button").click(function(e){ Index.processSubmit(); });

    	$('.inplaceError').each(
    			function(i) {
    				$(this).focus(function(e){
    					$("#loginerror").html("");
    				});
    			}
    	);
    },
    processSubmit		: function(event){
    	$('#login').submit();
    }
    

    };

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski