Reputation: 6839
I have a aspx page that I need to call without going directly on that page.
I have tried to make POST from form but it opens this action url in browser.
<form method="POST" action="http://mysite/actionpage.aspx">
<input type="submit" value="Submit" />
</form>
Upvotes: 0
Views: 1963
Reputation: 318
I haven't tested , but looks like you are navigating to .aspx means server page, i.e. you need to use runat="Server" in your tags like this
Upvotes: 0
Reputation: 1833
You can do it via ajax. For example, if you add a script reference to jQuery things will get much easier, and you can do the following:
<script type="text/javascript">
function postIt()
{
$.post(
"http://mysite/actionpage.aspx"
, function(data)
{
// data was returned from the server
alert("data posted in the background");
} );
}
</script>
The processing you be done via background.
Your final HTML woul be :
<form method="POST" action="http://mysite/actionpage.aspx">
<input type="submit" value="Submit" onclick="postIt();" />
</form>
Upvotes: 1
Reputation: 3823
You could use curl
if you're on a *nix system.
Here is a reference on how to post data to a page. The result will be returned through the command line.
What is the curl command line syntax to do a post request?
Here is the syntax for reference:
curl -d "param1=value1¶m2=value2" http://example.com/resource.cgi
or
curl -F "[email protected]" http://example.com/resource.cgi
Upvotes: 1
Reputation: 218922
If jQuery is allowed to use in your case, You may use jQuery ajax to call that page
$("form").submit(function(e){
e.preventDefault();
$.post("yoursecondpage",function(data){
//do whatever with the response from that page
});
});
Upvotes: 1