hi all,

in javascript normaly page redirection can be done as follow with a parameter.

window.location = "add-new-cos.jsp?id="+id;

but this id value is send to the next page with in the GET method. but i want to send it with the POST method.

is there any way to do it with javascript....?

thanks..
janaka priyadarshana.

Recommended Answers

All 4 Replies

Member Avatar for Rhyan

hi all,

in javascript normaly page redirection can be done as follow with a parameter.

window.location = "add-new-cos.jsp?id="+id;

but this id value is send to the next page with in the GET method. but i want to send it with the POST method.

is there any way to do it with javascript....?

thanks..
janaka priyadarshana.

Yes, there is, and it is called AJAX. Search through the AJAX forums for posting values using JS with the POST method.

Another way is to create a hidden input element, use then JS to change the hidden element value and submit the form.
e.g. something like should work, however I have not tested it. If you're familiar with JS you will figure it out.

fucntion sendByPost(hiddenField)
{
var = myvalue;
var myHiddenfield = document.getElementById(hiddenfield);
myHiddenfield.value = myvalue;
document.form.submit();
}

Good luck

commented: thanks +0

thanks for the idea. the second idea is the way that i wanted to know.

IT s VERY helpful for me

Yeahh.... thats great idea to use a hidden field.
Thanks from my side too...... :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.