當通過ajax POST提交客戶信息時,我收到了來自IE8(僅限IE8)的奇怪迴應。
正確執行的動作,是對CRM創建的客戶和所有後續的動作將被執行,也將重新打開窗口,這是一個新的窗口頂部URL彈出...
我無法確定這是爲什麼發生。我剝離了代碼,只包含了通話後沒有成功。
工作代碼在下面,我出於安全考慮而採取了公司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 protected]', 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); ?>
不知道他們爲什麼做IE ..:P – 2013-04-08 09:09:19