On change of dropdown im reading the drop down value and making on ajax call to fetch the data.I want to refresh the same page. i tried this
$('#status').change(function(){
var status = $('#status').val();
$.ajax({
url : "Partners.action",
data: {status : status},
success : function(data) {
alert(status);
$("#status").html(data);
}
});
});
but it is not refreshing
$('#status').change(function(){
var status = $('#status').val();
$.ajax({
url : "Partners.action",
data: {status : status},
success : function(data) {
alert(status);
$("#status").html(data);
window.location="currentPageURL.aspx?data="+data; /// for refreshing the page
}
});
});
Solution 1:
You can do the page refresh using the method proposed by @Neel. But In case you want to refresh the whole page and get the data back, you first need to store it in some database.
Also, you are filling the data in the same control on which you are observing the .change
event.
Replace $("#status").html(data);
with $('#YourHTMLControl').html(data);
Alternate Method: Another way of doing it would be the use of querystring. You can do it something like this.
success : function(data) {
alert(status);
$("#status").html(data);
window.location="currentPageURL.aspx?data="+data;
}
Later you can read the querystring on page load and insert it into the desired control using javascript or any server side method.
Hope it helps.