Test your technical skills online, appear in Virtual Interview and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Make friends on DotNetFunda.com and expand your network!
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Codes Author
Thu, 17-Apr-2014 Authors
All Time Authors
Satyapriyanayak
11600
Jayakumars
8120
Niladri.biswas
6000

Latest members | More ...


(Statistics delayed by 5 minutes)

How to post to a URL with Parameters?

Shantanupatel
Posted by Shantanupatel under JavaScript on 3/9/2012 11:22:53 AM | Points: 40 | Views : 1485 | Status : [Member]

<div>

<form method="post" action="">
<input type="hidden" id="url" name="url" value="http:\\mysite"/>
<input type="hidden" id="parameter" name="parameter" value="polNo=23|seqNo=3456|status=A"/>
</form>
</div>

<script type="text/javascript" language="javascript">
$(document).ready(
function () {
postToUrl($("#url").val(), $("#parameter").val(), "post");
}
);

function postToUrl(path, params, method) {
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "parameter");
hiddenField.setAttribute("id", "parameter");
hiddenField.setAttribute("value", params);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
}
</script>


Shantanu
Found interesting? Add this to:



Comments or Responses

Posted by: T.Saravanan on: 3/9/2012 | Level:Silver | Status: [Member] [MVP] | Points: 10

Hi,

Kindly post your code inside the code tag.

Posted by: Shantanupatel on: 3/9/2012 | Level:Starter | Status: [Member] | Points: 10

Updated!


Login to post response.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.