Итак, я пытаюсь использовать функцию .post jquery для отправки формы и возврата результатов на той же странице. Я попытался использовать пример, найденный в jquery's documentation. Форма отправляется успешно, но ничто не возвращается на страницу формы.JQuery .post() удаленно отправляет
Я мои JS настроить как:
соответствующая часть формы сценария на test3.php выглядит следующим образом:
<div id="form_results">
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://mydomain.com/openx/www/delivery/rtl.php':'http://mydomain.com/openx/www/delivery/rtl.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=4");
document.write ('&cb=' + m3_r);
//you Should pass your Keyword
document.write ('&keyword=<?php echo urlencode($_POST["keyword"]);?>');
//you Should pass your Zipcode
document.write ('&zipcode=<?php echo urlencode($_POST["zip"]);?>');
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
document.write ("&loc=" + escape(window.location));
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://mydomain.com/openx/www/delivery/ck.php?n=a9d134b1&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://mydomain.com/openx/www/delivery/avw.php?zoneid=4&cb=INSERT_RANDOM_NUMBER_HERE&n=a9d134b1' border='0' alt='' /></a></noscript>
</div>
Что я делаю неправильно здесь? Почему он не возвращает результаты в div #result? Я смотрел заголовки, поэтому я знаю, что данные успешно передаются.
В Chrome сделайте сообщение и посмотрите в разделе «Сеть». Посмотрите, что ответ. – teynon
Также проверьте данные, возвращаемые из обратного вызова в методе $ .post(). –