jQuery: The Write Less, Do More JavaScript Library

ajax not sending back details

View: New views
2 Messages — Rating Filter:   Alert me  

ajax not sending back details

by numerical25 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to send data to a remove server via ajax. I am recieving the xmlHttpRequest Object, but all of its properties are undefined or empty

  $('#testReq').click(function(){
       
                alert('Button Works!');
                 $.ajax({
                   type: "POST",
                   url: "http://play.anthonylgordon.com/usersessions/store",
                   data: 'data=Test',
                   error: function(e) { alert("Failure: " + e.readystatechange ); }, //Comes back undefined
                   success: function(msg){
                         alert( "Data Saved: " + msg );
       
                   }
                               
                });
       
        })


I also tried
e.responseText

and

e.statusText

and all of the other properties. what am i doing wrong

Re: ajax not sending back details

by MorningZ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There's something wrong in your server code:

Parse error: syntax error, unexpected '[' in /home/lastings/
public_html/play/app/controllers/usersessions_controller.php on line
15

As for trapping the error in jQuery... this always works for me as an
error catch:

error: function(x, y, z) {
     // x.responseText is what the server is saying
}

On Nov 2, 11:55 am, numerical25 <numerica...@...> wrote:

> I am trying to send data to a remove server via ajax. I am recieving the
> xmlHttpRequest Object, but all of its properties are undefined or empty
>
>   $('#testReq').click(function(){
>
>                 alert('Button Works!');
>                  $.ajax({
>                    type: "POST",
>                    url: "http://play.anthonylgordon.com/usersessions/store",
>                    data: 'data=Test',
>                    error: function(e) { alert("Failure: " + e.readystatechange ); },
> //Comes back undefined
>                    success: function(msg){
>                          alert( "Data Saved: " + msg );
>
>                    }
>
>                 });
>
>         })
>
> I also tried
> e.responseText
>
> and
>
> e.statusText
>
> and all of the other properties. what am i doing wrong
> --
> View this message in context:http://old.nabble.com/ajax-not-sending-back-details-tp26157740s27240p...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.