PHP 스크립트에 AJAX (jQuery)를 사용하여 양식을 제출할 예정입니다.
if (!empty($_POST)){
$adestra = $this->adestraAction('contact.create' , array('1', array('1.email' => $_POST['email'] , '1.forename' => $_POST['firstname'] , '1.surname' => $_POST['lastname'],'1.source' => 'signupbox')));
$add = $this->addToListAction($adestra, $magazineID);
}
$ _POST varibles 설정 받고있는 것으로 보이지 않는다 :이 코드가
// Validate form fields
$(function() {
//Check to see if email is not empty
if (email == "") {
$("label#email_error").show();
$("input#email").focus();
return false;
}
var dataString = 'firstname=' + firstname + '&email=' + email + '&lastname=' + lastname;
$.ajax({
type: "POST",
url: "/",
data: dataString,
success: function() {
var counter = <?php echo($counter['count'] + 1); ?>
counter = numberWithCommas(counter);
$('#counter').html(counter);
$('#contact_form').html("<div id='message'></div>").fadeIn(1500, function() {
$('#message').html("<h2>Thanks " + (firstname) + "!</h2>").append("<p>We will be in touch soon.</p>");
});
}
});
return false;
});
PHP 스크립트 내 : 여기
는 자바 스크립트입니다. 아무도 도와 줄 수 있습니까?
아약스 쿼리를 게시 할 수 있습니까? 또는 포스트 변수를 인쇄하는 경우 PHP 파일에서 무엇을 얻을 수 있습니까? php print_r ($ _ POST);?> –
jquery 코드도 게시 할 수 있습니까? 어쩌면 그것은 GET 요청을하고있다. 그러나 그렇지 않더라도, 코드를 보는 것이 도움이 될 것이다. –
확실한 ajax 쿼리는 : – richelliot