homepage Welcome to WebmasterWorld Guest from 23.20.149.27
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Which to use: jquery .ajax or .post?
neophyte




msg:4454416
 4:22 am on May 17, 2012 (gmt 0)

Hello All -

Even though I've been coding php for years now, I'm just (amazingly) getting into javascript and jquery.

So far so good, but I'm confused by the various arguments and syntax needed for $.ajax or $.post functions when interacting with a database.

Is one better/more flexible than the other (it would seem that .ajax is more flexible).

I'm really getting into this now and would like to start off right - any suggestions gratefully accepted!

Also, if anyone can point me to some good newbie tutorials (on or off-list) for jquery database functions (.ajax/.post/whatever) that would also be great.

 

daveVk




msg:4454464
 8:16 am on May 17, 2012 (gmt 0)

[api.jquery.com...] says for $.post


This is a shorthand Ajax function, which is equivalent to:

$.ajax({
type: 'POST',
url: url,
data: data,
success: success,
dataType: dataType
});



Similarly for $.load $.get etc. Master $.ajax, the rest are for convenience.

Fotiman




msg:4454578
 1:36 pm on May 17, 2012 (gmt 0)

It's important to note that jQuery/JavaScript does not do any direct interacting with a database. You can send HTTP requests to the server, but you still need some page on the server to handle the request and communicate with the database (probably a PHP page in your case).

Also, the jQuery API documentation is a good place to start. It's fairly well documented. :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved