I am doing simple Jquery ajax post to php and I am very new to three languages. Any suggestion or guidance.

I have two iframes
1. iframe 1 is Navigation menu(loaded with flash menu).
<iframe name=”menu”/>
2. iframe 2 is load the web page.
<iframe name=”page_load”/>
When I click the navigation menu the corresponding web page loaded.
In one part, when I clicked the navigation “menu” the login_reg.php page open in page_load.
The login_reg page has two parts of form,
1. In one, registration process is done
<form id=”registration”/>
2. In another, login is done.
<form id=”login_form”/>

When I submit the login_form, it check the login and password.if it success, both parent iframes should be reloaded by corresponding src attribute,

MY problem:

  1. But sometimes it getting refresh without any changes and.
  2. Mozilla, safari it doesn’t works and just page is get refreshed.

My Jquery and ajax script:


$("form#login_form").submit(function() { 

alert('this method is called');

var user_id=$('#user_id').val();
var p_word=$('#p_word').val();

if(user_id.length >= 4 && p_word.length>=4)

    type: "POST",  
    url: "login-exec.php",  
    data: "user_id="+ user_id + "&p_word="+p_word,  

    success: function(msg){  

   alert('it entered the message');

    if(msg == 'OK')


    else  if(msg=='NOT')
alert('the message is alert is not OK');




    $("#status1").html('<font color="red">The username should have at least <strong>4</strong> characters.</font>');


PHP script:
include_once dirname(__FILE__).'/sql.php';

$link = mysql_connect(server, user, password);

        die('Failed to connect to server: ' . mysql_error());

    $db = mysql_select_db(DB_CATALOG);
    if(!$db) {
        die("Unable to select database");

    function clean($str) {
        $str = @trim($str);
        if(get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        return mysql_real_escape_string($str);
    $username = clean($_POST['user_id']);
    $password = clean($_POST['p_word']);
    $qry="select * from customer_se where username='".$username."' and password='".md5($password)."'";

            echo 'OK';

            echo 'NOT';



Thanks in advance,

With Regards,
Eswaran Saravanan,
University west,

Edited by Reverend Jim: Fixed formatting

7 Years
Discussion Span
Last Post by Airshow

Sorry I am missed one Curly braces here when I am copying the code from editor.But its not a java script error.But in the form I am correctly given the Curly braces.Thats not my problem.

MY problem is,

1)Some times in Internet explorer, the submit method is called and suddenly only the page get refreshed not reloading the iframes.
2)Also in Mozila and Safari it call the submit method in jquery and get refreshed without reloading the iframes.

Thanks in advance,

With Regards,
Eswaran Saravanan,
University west,



Thats not my problem.

I know that's not your problem but it is my problem in trying to replicate your problem!

I can make a calculated guess as to where the missing line belongs but I may be wrong.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.