Javascript‎ > ‎JQuery‎ > ‎

How to use the "$.get" method

The "get" method will invoke a "GET" ajax request. 

Here is an example of how to invoke this method with data on select change event

My HTML is:

<select onchange="loadContent(this)">
     <option value="val1">Value 1</option>
     <option value="val2">Value 2</option>
     <option value="val3">Value 3</option>
<div id="contentHolder"></div>

And the ajax call will be : 

<script language="javascript" type="text/javascript">
      function  loadContent(select){
          $.get('/contentUrl', { filter : $(select).val() }, function(result){ $("#contentHolder").html(result)});

Assuming the user chose "Value 1" on the select - the ajax call invokes the URL : 
and sets the result inside "contentHolder"  div.