1

I have an cURL call that works and I have converted it to an ajax call. The ajax call is failing. How do I get something to return from the call? There should be a dictionary [cURL call returns a dictionary].

How do I know what is failing in my call? I don't know how to proceed in debugging it.

Thanks

curl -v -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -X PUT --user user:pass https://my.address.for/this/url -d "{\"name\": \"Marcus0.3\",\"start\": 500000,\"end\": 1361640526000}"


                    $.ajax({
                    type: 'put',
                    url: 'https://my.address.for/this/url',
                    dataType: 'json',
                    async: false,
                    username: 'user',
                    password: 'pass',
                    data: {
                        "name": "Marcus0.3",
                        "start": 500000,
                        "end": 1361640526000
                    },
                    success: function(){alert('DONE!');},
                    error: function(){alert('fail');},
            }).responseText;

I keep getting 'fail' responses

Marcus
  • 9,032
  • 11
  • 45
  • 84

2 Answers2

1

If you type F12 it will open up chrome dev tools, then click on the network tab.

You will see all requests, including ajax requests as they happen. You can click on the line item "name" field for full info about the request and response, similar to cURL verbose mode

Jonah
  • 15,806
  • 22
  • 87
  • 161
0

You can use Firefox with firebug to get the exact error message.Else do like this

error:function(error){alert(error)}

Durai
  • 542
  • 3
  • 4