Tags related to tag ajax
Thursday, March 9. 2006
More AJAX and REST, Default Request Entity Content Types
Something else you should be aware of when playing around with AJAX: the default request entity of XmlHttpRequest, in mozilla at least, is of the type application/xml. It will also set a Content-Length header of 0.
I have no idea how IE, Safari or Opera would handle a POST request with no entity set.
I have no idea how IE, Safari or Opera would handle a POST request with no entity set.
Monday, January 16. 2006
More AJAX grumbles
I figured out a bee in my bonnet. For awhile this error has been plaguing me:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://bunny.jonnay.net/projects/TileEditor/project.js :: checkStatus :: line 47" data: no]
Turns out It was because I wasn't sending an empty string after my XmlHttpRequest open. That empty send is important.
Error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://bunny.jonnay.net/projects/TileEditor/project.js :: checkStatus :: line 47" data: no]
Turns out It was because I wasn't sending an empty string after my XmlHttpRequest open. That empty send is important.
Posted by jonnay
in Code
at
20:38
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: ajax, javascript
Debugging Restuful Ajax... Part Deux.
In my last entry about Debugging REST and AJAX, I talked about using telnet as an easy way to figure out WTF is going on with your application, if you have some kind of general badness.
Incidentally enough, it also comes in handy when you want to quickly do a var_dump, or other debugging. I found though, that when using PuTTY to paste in signficant chunks of urlencoded data, that there was some kind of server/client communication issues.
Enter cURL, the ultimate in HTTP debugging tools. You can pass in request data via the --data option, conversely, there is always the --form option if that is your cup of tea. There are ways to set the referer, user agent, cookies, even teh request method. Its mighty nice.
For instance, I was working on my Tile Editor (more on this real soon), and I was having a problem with my AJAX put request. I snarfed the headers my browser was sending using HttpLiveHeaders, grabbed the request vars, and stashed that in a file called 'requestdata'. Then I told curl to read that in as request data, and spit out the response data. Finally, I wanted to use the PUT method, and this was as easy as using the --request option.
curl --data @requestdata --include --request PUT http://bunny.jonnay.net/projects/TileEditor/tiles/tile.php/43c97b37c7211
Clickity Click. Barba Trick. cURL is mana from heaven for the HTTP hacker.
Incidentally enough, it also comes in handy when you want to quickly do a var_dump, or other debugging. I found though, that when using PuTTY to paste in signficant chunks of urlencoded data, that there was some kind of server/client communication issues.
Enter cURL, the ultimate in HTTP debugging tools. You can pass in request data via the --data option, conversely, there is always the --form option if that is your cup of tea. There are ways to set the referer, user agent, cookies, even teh request method. Its mighty nice.
For instance, I was working on my Tile Editor (more on this real soon), and I was having a problem with my AJAX put request. I snarfed the headers my browser was sending using HttpLiveHeaders, grabbed the request vars, and stashed that in a file called 'requestdata'. Then I told curl to read that in as request data, and spit out the response data. Finally, I wanted to use the PUT method, and this was as easy as using the --request option.
curl --data @requestdata --include --request PUT http://bunny.jonnay.net/projects/TileEditor/tiles/tile.php/43c97b37c7211
Clickity Click. Barba Trick. cURL is mana from heaven for the HTTP hacker.
Thursday, January 12. 2006
Debugging Ajax
When debugging an Ajax application, especially one that is talking to a REST API, especially especially if that REST API is one of your own building.
I was getting this strange error in the JavaScript console, NS_ERROR_ILLEGAL_VALUE 80070057. Something about an uncaught exception. Well, the solution was to stop using AJAX, and get right down to brass tacks: Telnet is your friend.
telnet bunny.jonnay.net 80
Trying 142.179.114.225...
Connected to panda-ba.sanriowasteland.net.
Escape character is '^]'.
DELETE /projects/TileEditor/tiles/tile.php?tiles=43c75444b6253 HTTP/1.1
Host: bunny.jonnay.net
If you just send raw request headers through telnet, it makes it a bit easier to understand what is happening. I will bet however, that if you are getting the NS_ERROR_ILLEGAL_VALUE messages, it means that you have some errant back-end code, and your error messages are none too friendly.
Better error messages will be a feature in meditation 0.2
I was getting this strange error in the JavaScript console, NS_ERROR_ILLEGAL_VALUE 80070057. Something about an uncaught exception. Well, the solution was to stop using AJAX, and get right down to brass tacks: Telnet is your friend.
telnet bunny.jonnay.net 80
Trying 142.179.114.225...
Connected to panda-ba.sanriowasteland.net.
Escape character is '^]'.
DELETE /projects/TileEditor/tiles/tile.php?tiles=43c75444b6253 HTTP/1.1
Host: bunny.jonnay.net
If you just send raw request headers through telnet, it makes it a bit easier to understand what is happening. I will bet however, that if you are getting the NS_ERROR_ILLEGAL_VALUE messages, it means that you have some errant back-end code, and your error messages are none too friendly.
Better error messages will be a feature in meditation 0.2
(Page 1 of 1, totaling 4 entries)




