我正在尝试在创建表单操作时向Web处理程序添加查询字符串。
firstName
将来自下拉列表。
这可以用jQuery完成吗?
<div>Want something like:</div>
<form action="FileTransferHandler.ashx?firstName="+Tommy+"; method="post" enctype="multipart/form-data"></form>
<div>if Possible via jQuery:</div>
<form action="FileTransferHandler.ashx?firstName=$("#ddlFirstName option:selected").text(); method="post" enctype="multipart/form-data"></form>
答案 0 :(得分:-1)
在Jquery中处理表单提交事件并构造您要添加的查询。表单将通过JQuery ajax发布,并在收到服务器响应时处理结果。
var url = "<actual url"+ <<constructed query string>>;
var jqxhr = $.get( "example.php", function() {
alert( "success" );
})
.done(function() {
//handle success response here
})
.fail(function() {
//handle failure response here
})
.always(function() {
//either success or fail perform this action
});