0
我有一個引導模式,用戶填寫表單並單擊提交後,它使用mailto鏈接打開用戶的郵件客戶端並填充新消息。無法在mailto鏈接後關閉引導模式
我希望模式在發生這種情況時關閉,但是當我添加代碼以關閉模式時,mailto鏈接不再起作用(郵件客戶端窗口未打開)。該模式成功關閉。有什麼建議麼?
$('#request-form').submit(function (evt) {
if ($("#request-form").valid())
{
evt.preventDefault();
var firstName = $("#FirstName").val();
var lastName = $("#LastName").val();
var company = $("#Firm").val();
var address = $("#Address").val();
var city = $("#City").val();
var state = $("#State").val();
var zip = $("#Zip").val();
var phone = $("#Phone").val();
var email = $("#EmailAddress").val();
var product = $("#ProductName").val();
//Send email using mailto link
var body = "Send this email <removed>.%0D%0A%0D%0AFirst Name: " + firstName + "%0D%0ALast Name: " + lastName + "%0D%0ACompany: " + company +
"%0D%0AAddress: " + address + "%0D%0ACity: " + city + "%0D%0AState: " + state + "%0D%0AZip: " + zip + "%0D%0APhone: " + phone + "%0D%0AEmail: " + email +
"%0D%0AProduct: " + product;
var subject = "Product Request";
var recipient = $("#Recipient").val();
window.location.href = "mailto:" + recipient + "?subject=" + subject + "&body=" + body;
$("#questions-modal").modal('hide');
}
});
CSHTML:
<button type="submit" class="btn btn-nav pull-right" id="btn-openMail" data-dismiss="modal">Submit</button>
[Works in a fiddle](http://jsfiddle.net/oywcgs00/) – mccannf 2014-10-02 18:38:12
此代碼片段似乎不完整。請包括你的完整的JS。 – cvrebert 2014-10-02 20:53:39
已更新我的代碼片段以包含整個功能。小提琴奏效了,有趣......看不出如何把你在那裏做的事情聯繫起來,在我的最後做出改變。 – Kelly 2014-10-03 18:32:00