ajax POST를 통해 고객 정보를 제출할 때 IE8 (이상 IE8)에서 이상한 응답이 표시됩니다.
조치가 제대로 실행, 고객은 CRM에 생성되고 모든 후속 조치가 실행되지만, 상위 URL이 팝업으로도 재 - 열리는 창, 즉 ... 새로운 창입니다
나는 이것이 왜 일어나고 있는지 정확히 지적 할 수 없다. 나는 포스트 콜만을 성공으로 포함 시키도록 코드를 제거했다.
아래의 작업 코드는 보안상의 이유로 회사 ID를 사용했습니다.
아이디어가 있으십니까?
자바 스크립트
$(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 –