03/26/08

Using POST and XML in AJAX

In an earlier entry, Missing Data After AJAX Call, I threw a hack together to return multiple values which required parsing based on a separator on the client side.

After testing, I realized using a character as a separator is a bad idea. The data returned could have the character as part of its value and screw up the parsing later on the client side. Storing the data as XML and returning the data as such makes for a more elegant solution.

I also wanted to send a large amount of text through AJAX and the GET request was not getting the job done. Using POST instead of GET works well; the reason behind it is similar to why it works for forms or forum postings.

Talking about the what’s and why’s does not make it very clear. That is why I brought an example with me including the corresponding code. w00t!
Continue reading

03/11/08

Missing Data After AJAX Call

I was working through the night last night, burning the midnight oil as they say, trying to get this AJAX deal to work. I had to fill a select field with options once the user selects an option from a second select field. But, every time I made the AJAX call to retrieve the data, the target select field remained empty… in IE. Argh! IE! Why do you haunt me so?!
Continue reading