<input type='text' name='zip' id="auction_zip" value='' class='input-box-login'/>
<input type="button" name="submit" value="submit" onclick="javascript:getAuctionsByZip(<?php echo $item_id ?>);" />

<div id=”auction_result”></div>

In js file

function getAuctionsByZip(item_id){
var zip = $('#auction_zip').val();

var url = base_url+’/auction-by-zip/’+item_id+’/’+zip; // print the result in this page, not return
$.get(url, function(data){
$(‘#auction_result’).html(data); // result will display in that div

});
}

http://viralpatel.net/blogs/jquery-ajax-tutorial-example-ajax-jquery-development/

Advertisements