I have the below code:
$.ajax({
type: "post",
url: "./api/v1/bluemix/auth",
data: datas,
success: function(data){
var successUrl = "CreateBluemixMonkey.jsp";
window.location.href = successUrl + "?data=" + newdata ;
},
error: function(jqXHR,error, errorThrown) {
alert("Error");
}
})
After a successful AJAX call, I am setting window.location.href
. Instead, can I do another post to the same JSP? I am trying to use hidden values but I doubt since there is no post method. I am getting all hidden field values as null
in CreateBluemixMonkey.jsp.
You could create a on the page with some hidden inputs and then invoke the submit-method. This way you generate a POST-Request instead of a GET-Request, which is generated from the window.location.href code line.
If possible, just create a static on your page which is hidden, preferably by setting 'display: none;'
as CSS-Style. Then give the form-tag an ID and run $('#form-id').submit();
in your success-function.