ASP.NET with jQuery - POST vs GET

Okay, I have a very stupid question that I have to say. I am using the nyroModal plugin for jQuery in an ASP.NET 3.5 WebForms application. Basically, let's say I have a hyperlink pointing to http://www.mysite.com/GetData.html?id=100

When the link is clicked, I want GetData.html to fetch data from the database and populate some innerHTML elements with the returned data. the querystring value will be output using the jqURL plugin for jQuery, and I will use the built-in jQuery Ajax function to make a web service call passing the id as a parameter.

My question is: . How do I use jQuery.Ajax () if it is not a POST method but a GET method as I understand it? According to the documentation, for $ .ajax () to work, the type must be "POST".

Can someone shed some light on this for me?

thanks

+1


a source to share


3 answers


You have many options:

1- use download method:

$('#container').load(("/page");  

      

2-use the get command:



$.get('/page')  

      

3 - use the ajax command:

$.ajax({
type:'GET',
url:'/page',
success:function() {
}
})

      

+4


a source


$.ajax({
  type: "GET",
  url: "test.js",
  dataType: "script"
});

      



... from the first example in the jQuery docs.

+2


a source


0


a source







All Articles