Ashkan
Ashkan

Reputation: 1673

JQuery $.post() doesn't work

Can any one help me with the following code:

$(document).ready(function() {
    $("#add_user").submit(function() {
        $.post( "../php/register_sql_ins.php",
            {r_fname: $("#fname").val(),
            r_lname: $("#lname").val(),
            r_uname: $("#uname").val(),
            r_pass: $("#pass").val(),
            r_authLevel: $("#authLevel").val(),
            r_email: $("#email").val(),
            r_company: $("#company").val(),
            r_phone: $("#phone").val(),
            r_address: $("#add").val()}, function(result) {
                    alert(result);
                }
            );
            return false;
    });
});

This should store my user data in a sql table. the php part of code(register_sql_ins.php) works fine. but this query piece of code just doesn't work!! and I have no idea what is the problem! With Firebug it returns false every time! By the way sorry for bad english. It's not my mother tong!

Upvotes: 0

Views: 2264

Answers (1)

RocketR
RocketR

Reputation: 3776

There are two places where I would look for the cause of such error:

  • Network tab in Firebug. Check what is sent to the server and what is the response. If data sent is correct and server replies with status 200, then you have to debug your PHP script, else
  • Server logs. If the request failed to complete succesfully, log will contain the reason.

Upvotes: 2

Related Questions