I'm looking to take data posted to a form, process it and then make a redirect to a third-party website w开发者_如何学Pythonith both GET data AND POST data.
I understand that Response.Redirect() is not the way to go about this - what is though?
I dont want to make the original form submit to the third party provider, I have some processing to do on their results first - so that's not an option.
Can anyone recommend a way for me to pass the user along to the 3rd party provider (outside of my domain)?
Typically (barring the use of web services), this is done by doing whatever processing you need, and then GETting or POSTing the data to the third party site. They would then POST or GET back at a later time (making this an asynchronous operation), to a pre-arranged URL on your site, or one that you pass along to them, allowing you to do whatever you want with their output.
html
<form id="aForm">
name: <input type="text" id="userName">
</form>
<script type="text/javascript">
jQuery.ajax({
url:'Home/FistAction',
data:jQuery('#aForm').serialize(),
type:'POST'
success:function(data){
// it would make more sense if received data is of type json
// pass this data to third party, with jsonp request type
}
});
</script>
[HttpPost]
public JsonResult FistAction(FormCollection f)
{
// process your form and creat new object 'NewObject'
//return json to make third party request
return Json(NewObject,JsonRequestBehavior.DenyGet)
}
精彩评论