jQuery ट्यूटोरियल

jQuery होम jQuery परिचय jQuery आरंभ करें jQuery सिंटेक्स jQuery चयनकर्ता jQuery की घटनाएँ

jQuery प्रभाव

jQuery छुपाएं/दिखाएं jQuery फीका jQuery स्लाइड jQuery चेतन jQuery स्टॉप () jQuery कॉलबैक jQuery चेनिंग

jQuery एचटीएमएल

jQuery प्राप्त करें jQuery सेट jQuery जोड़ें jQuery निकालें jQuery सीएसएस कक्षाएं jQuery सीएसएस () jQuery के आयाम

jQuery ट्रैवर्सिंग

jQuery ट्रैवर्सिंग jQuery के पूर्वज jQuery के वंशज jQuery भाई बहन jQuery फ़िल्टरिंग

jQuery AJAX

jQuery AJAX परिचय jQuery लोड jQuery प्राप्त करें/पोस्ट करें

jQuery विविध

jQuery नो कॉन्फ्लिक्ट () jQuery फिल्टर

jQuery के उदाहरण

jQuery के उदाहरण jQuery प्रश्नोत्तरी jQuery व्यायाम jQuery प्रमाणपत्र

jQuery संदर्भ

jQuery अवलोकन jQuery चयनकर्ता jQuery की घटनाएँ jQuery प्रभाव jQuery एचटीएमएल/सीएसएस jQuery ट्रैवर्सिंग jQuery AJAX jQuery विविध jQuery गुण

jQuery प्राप्त करें () विधि :

❮ jQuery AJAX के तरीके

उदाहरण

किसी पृष्ठ पर HTTP GET अनुरोध भेजें और परिणाम वापस प्राप्त करें:

$("button").click(function(){
  $.get("demo_test.asp", function(data, status){
    alert("Data: " + data + "\nStatus: " + status);
  });
});

परिभाषा और उपयोग

$.get() विधि HTTP GET अनुरोध का उपयोग कर सर्वर से डेटा लोड करती है।


उदाहरण

"Test.php" का अनुरोध करें, लेकिन वापसी परिणामों पर ध्यान न दें:

$.get("test.php");

"test.php" का अनुरोध करें और अनुरोध के साथ कुछ अतिरिक्त डेटा भेजें (वापसी परिणामों को अनदेखा करें):

$.get("test.php", { name:"Donald", town:"Ducktown" });

"test.php" का अनुरोध करें और सर्वर को डेटा की सरणियाँ पास करें (रिटर्न परिणामों को अनदेखा करें):

$.get("test.php", { 'colors[]' : ["Red","Green","Blue"] });

"test.php" का अनुरोध करें और अनुरोध के परिणाम को सचेत करें:

$.get("test.php", function(data){
  alert("Data: " + data);
});


वाक्य - विन्यास

$.get(URL,data,function(data,status,xhr),dataType)

Parameter Description
URL Required. Specifies the URL you wish to request
data Optional. Specifies data to send to the server along with the request
function(data,status,xhr) Optional. Specifies a function to run if the request succeeds
Additional parameters:
  • data - contains the resulting data from the request
  • status - contains the status of the request ("success", "notmodified", "error", "timeout", or "parsererror")
  • xhr - contains the XMLHttpRequest object
dataType Optional. Specifies the data type expected of the server response.
By default jQuery performs an automatic guess.
Possible types:
  • "xml" - An XML document
  • "html" - HTML as plain text
  • "text" - A plain text string
  • "script" - Runs the response as JavaScript, and returns it as plain text
  • "json" - Runs the response as JSON, and returns a JavaScript object
  • "jsonp" - Loads in a JSON block using JSONP. Will add an "?callback=?" to the URL to specify the callback

❮ jQuery AJAX के तरीके