$(document).ready(function() {
$('#postComment').click(function(e) {
e.preventDefault();
var articleId = $('#articleId').val();
var commTitle = $('#commTitle').val();
var commBody = $('#commBody').val();
alert(articleId + commTitle + commBody);
$.ajax({
type: "POST",
url: 'https://www.d o m a i n.com/content/inc/postComment.php', // removed actual domain for this posting
data: {"articleId": articleId}, // this var does not pass to postComment.php
data: {"commTitle": commTitle}, // this var does not pass to postComment.php
data: {"commBody": commBody}, // this var DOES pass to postComment.php
success: function(response)
{
$('#responseComm').css('color', 'green');
$('#responseComm').val('Comment submitted successfully!');
$("#response").html('There is outcome while submit' + commTitle + '
' + commBody);
}
});
});
});
Чтение и перечитывание Я не знаю, почему 2 переменные не передаются, а одна — да. Вызов JQuery Ajax (окр. LAMP): [code] $(document).ready(function() { $('#postComment').click(function(e) { e.preventDefault(); var articleId = $('#articleId').val(); var commTitle = $('#commTitle').val(); var commBody = $('#commBody').val(); alert(articleId + commTitle + commBody); $.ajax({ type: "POST", url: 'https://www.d o m a i n.com/content/inc/postComment.php', // removed actual domain for this posting data: {"articleId": articleId}, // this var does not pass to postComment.php data: {"commTitle": commTitle}, // this var does not pass to postComment.php data: {"commBody": commBody}, // this var DOES pass to postComment.php success: function(response) { $('#responseComm').css('color', 'green'); $('#responseComm').val('Comment submitted successfully!'); $("#response").html('There is outcome while submit' + commTitle + ' ' + commBody); } }); }); });