Код: Выделить всё
$(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);
}
});
});
});
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/79151756/jquery-ajax-call-not-sending-all-variables-via-a-post-request[/url]