In my website, after the user logs in, and a successful login response follows as a result of ajax login request, I want the user to be redirected to a 'appusers/appusers', such that the request sent to the server side module 'appusers' is a post request with some params like limit, offset etc. How do I accomplish this with jquery on the client side?
2 Answers
You can fill in fields of a POST form dynamically and trigger the submit() button and it will go to the action page set.
<form action="appusers/appusers" method="POST"> <input id="limit" type="hidden" value="" name="limit" /> </form> In the success function of the AJAX call,
$('#limit').val('My Limit'); $(form).submit(); Comments
You can make an ajax call for your login request like this for example:
$.ajax({ url: getSvcUrl(service, method), type: "GET", data: request, dataType: "json", contentType: "application/json; charset=utf-8", async: isAsync, success: redirectToPage(); , ... and in the redirectToPage() function called onSuccess you can do a window.location="http://www.bing.com" or a location.replace("http://www.microsoft.com") for a GET or submit a form for a POST ($("#myForm").submit())