try also catching the "error" event and see what the problem is (which
make no doubt about it, something is wrong with the response for
jQuery to not go into "success"

 $.ajax({
                type: "POST",
                url: "submit1.php",
                data: $("#regist").serialize(),
                dataType: "json",
                success: function(){
                        $("#loading").append("<h2>you are here</h2>");
                        },
                error: function(x,y,z) {
                    //  x.responseText  <-- will have the server side
error message if PHP outputs what is wrong
                }

        });

On Dec 28, 8:20 am, idcoder <idrishlaxmid...@gmail.com> wrote:
> Hi,
> Can anyone explain me what does success function arguments
> contain..for ajax jquery..
> I read the following in the documentation
>
> success -> Function
> A function to be called if the request succeeds. The function gets
> passed two arguments: The data returned from the server, formatted
> according to the 'dataType' parameter, and a string describing the
> status. This is an Ajax Event.
>
> function (data, textStatus) {
>   // data could be xmlDoc, jsonObj, html, text, etc...
>   this; // the options for this ajax request
>
> }
>
> "i want to know what is the data and textStatus"
>
> I have this code here :
>
> $(document).ready(function(){
> $("form#regist").submit(function() {
>                 var str = $("#regist").serialize();
>                 $.ajax({
>                 type: "POST",
>                 url: "submit1.php",
>                 data: $("#regist").serialize(),
>                 dataType: "json",
>                 success: function(){
>                         $("#loading").append("<h2>you are here</h2>");
>                         }
>
>         });
>                 return false;
>         });
>
> });
>
> the success part does not work.. i can enter the data into the DB if
> all fields entered are correct..However if something is wrong then
> nothing happens.
>
> Can anyone guide me where i am going wrong..Thanks a lot..

Reply via email to