views:

432

answers:

5

hello, i am new to javascript and jQuery both... i am developing one page in which i have generated page's whole html from code... in the page there in one textbox to Post Messages and for each message comments can be posted... now when i post a new comment oor delete comment i need to do database call. i knew 2 method to do it from js

  1. do xmlhttprequest
  2. do ajax call from jQuery.

can anybody suggest me which method will suite my requirement?? -thanks in advance

+2  A: 

xmlhttprequest is not working through cross-browser, for example some IE versions, so best option is jQuery's ajax call.

S.Mark
+1  A: 

read this. it will help you.

Reigel
+4  A: 

Each browser has their own implementation of XmlHttpRequest. Using a framework will minimize the headache of cross-browser differences and quirks, especially if you are very new.

Dominic Barnes
thanks ... i have one method in same page which calls wcf service to delete the comment. can you please tell me that how to call that method using jquery[ajax] coz whatever examples i saw in that there is url of a page... then how to call method of that page as well as i dont want to refresh the whole page..my method also returns CommentId based on that i have to generate some html and write it in div... can you please suggest me any good article to see sample code for the same?
Radhi
I think you can find those questions already answered here in Stackoverflow... if you can't find answers, just raise them up and we'll try to help you...
Reigel
+2  A: 

jQuery itself will be using XMLHTTPRequest object. What it provides will be a wrapper for the functions. So if you want to avoid the burden of writing javascript that targets various browsers then you can opt for jQuery.

rahul