How to reload and redirect in jQuery
Reload a page with jquery
you can simply reload or refresh a page by this small piece of code.
$('#button').click(function() {
location.reload();
});
or you can refresh a window using these javascript functions
- location = location
- location = location.href
- location = window.location
- location = self.location
- location = window.location.href
- location = self.location.href
- location = location['href']
- location = window['location']
- location = window['location'].href
- location = window['location']['href']
// similar behavior as an HTTP redirect window.location.replace("http://thecoderain.blogspot.in"); // similar behavior as clicking on a link window.location.href = "
http://thecoderain.blogspot.in
";
Redirect on another page and pass parameters in url using JS
<script type="text/javascript"> function showDetails(username) { window.location = '/
country
_detail?username='+username;
}
</script>
<input type="button" name="theButton" value="Detail" onclick="showDetails('username');">
OR
$(document).on('click', '.btn', function() {
var name = $(this).data('username');
if (name != undefined && name != null) {
window.location = '/country_detail?username=' + name;
}
});
try this site
ReplyDeleteRelated Site
website link
get more
look at this site