通过 ajax POST 提交客户信息时,我收到了来自 IE8(仅 IE8)的奇怪响应。
操作正确执行,客户在 CRM 上创建并执行所有后续操作,但窗口也重新打开,即弹出顶部 URL 的新窗口...
我无法确定为什么会这样。我剥离了代码以仅包含 post 调用而没有成功。
工作代码如下,出于安全原因,我只是拿了公司 ID。
有任何想法吗?
Javascript
$(document).ready(function () { $('button').click(function () { postNsData(); }); }); function postNsData() { var nsurl = 'https://forms.netsuite.com/app/site/crm/externalleadpage.nl'; var datamin = { compid: xxxxxx, //Company ID -- it's a number. formid: 503, h: '1e705f3aa4570f197aef', leadsource: 8020, subsidiary: 2, email: 'email@gmail.com', firstname: 'John', lastname: 'Doe', phone: '1800902011', }; $.ajax({ type: 'POST', url: 'repost.php', data: 'url=' + nsurl + '&' + data, success: function (text, textStatus, jqXHR) { if (textStatus == 'success') {} } }); }
PHP 代码——repost.php
<? php //set POST variables $url = $_POST['url']; unset($_POST['url']); $fields_string = ""; //url-ify the data for the POST foreach($_POST as $key = > $value) { $fields_string. = $key.'='.$value.'&'; } $fields_string = rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, count($_POST)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); ?>