views:

56

answers:

1

I'm creating easy to use kannada comic reader on mac for my cousins. I'm able to pull the comic pages, but lot of meta content exchanged webpage and server using XMLHttpRequest.

I'm finding difficulties use XMLHttpRequest, could anyone tell me how can I use it?

+1  A: 

The closest thing to a simple XMLHttpRequest is to create a data object from a URL.

For more advanced requests (e.g., custom headers, request methods that aren't GET), you'll need to use NSURLConnection. You should probably do that anyway; your application will be more robust and more responsive for it.

Peter Hosey
Keep in mind dataWithContentsOfURL: is synchronous and will result in a blocking UI during the request. Use NSURLConnection for asynchronous requests.
Tim van Elsloo
Yup. Uncareful use of `dataWithContentsOfURL:` is a good way to make a slow UI and frustrate the user. When the URL isn't local, you generally should use NSURLConnection instead.
Peter Hosey