Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an alternative to .load() in jQuery?

Tags:

jquery

Is there an alternative to .load() in jQuery?

like image 246
X10nD Avatar asked Jul 05 '10 10:07

X10nD


People also ask

Which is the alternative to load event in Ajax?

Use $. ajax instead of . load function. But make sure you specify the dataType as html for the ajax function. .

What is the difference between jQuery get () and jQuery load ()?

get() executes an Ajax GET request. The returned data (which can be any data) will be passed to your callback handler. $(selector). load() will execute an Ajax GET request and will set the content of the selected returned data (which should be either text or HTML).

What is load method in jQuery?

The jQuery load() method is a simple, but powerful AJAX method. The load() method loads data from a server and puts the returned data into the selected element. Syntax: $(selector).load(URL,data,callback); The required URL parameter specifies the URL you wish to load.


1 Answers

Yes, you can use $.ajax() directly if you need additional control over what .load() offers.

There are also other $.ajax() shorthand methods available.

  • $.get()
  • $.getJSON()
  • $.getScript()
  • $.post()
like image 98
Nick Craver Avatar answered Oct 17 '22 13:10

Nick Craver