Этот ломает мне мозг.
Я пытаюсь получить данные $ _POST из формы и поместить их в div на той же странице, что и форма, используя Ajax в среде mootools. И я не могу заставить это работать, сообщение успеха показывает, div только заполняется: Array ().
Файл php прост:
<code><?php
print "<pre>".print_r($_POST, true)."
";
?>
А вот мой JavaScript:
window.addEvent('domready', function() {
$('form-booking').addEvent('submit', function(event) {
event.stop();
var log = $('log_res').empty().addClass('ajax-loading');
this.set('send',{
url: this.get("action"),
data: this,
update: log,
onComplete: function(response) { log.removeClass('ajax-loading');
alert('Succesvol aangevraagd.'); $('log').setStyle('background','#ffffff');
}
}).send();
});
});
UPDATE
Header:
Connection Keep-Alive
Content-Length 0
Content-Type text/html
Date Fri, 09 Mar 2012 12:06:17 GMT
Keep-Alive timeout=5, max=100
Location http://192.168.52.64/xampp/
Server Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By PHP/5.3.1
POST:
<code><pre>Array
(
[date_from] => 1331300252
[service_check_8] => 1
[service_check_34] => 1
[booking_form] => 1
[cnt_nights] => 7
[cnt_person] => 2
[cnt_children] => 0
[cnt_baby] => 0
[child_ages] => Array
(
[0] => 2
[1] => 2
[2] => 2
[3] => 2
[4] => 2
[5] => 2
[6] => 2
[7] => 2
[8] => 2
[9] => 2
[10] => 2
[11] => 2
[12] => 2
[13] => 2
[14] => 2
[15] => 2
[16] => 2
[17] => 2
[18] => 2
[19] => 2
)
[service_cnt_8] => 2
[subservice_16] => 614
[service_cnt_34] => 1
[subservice_40] => 301
[subservice_88] => 688
[service_cnt_67] => 1
[subservice_122] => 762
[service_cnt_68] => 1
[subservice_123] => 765
)