Mam poważny problem.
Uczę się AJAXa i napotkałem problem. Korzystam z jQuery.
Mam taki kod, który wysyła formularz:
<?php
<script type="text/javascript">
$(function() {
$('.error').hide();
$(".submit").click(function() {
$('.error').hide();
var comment = $("textarea#comment").val();
if (comment == "") {
$("label#comment_error").fadeIn();
$("textarea#comment").focus();
return false;
}
var comment = $("textarea#comment").val();
var dataString = 'comment='+ comment;
//alert (dataString);return false;
$.ajax({
type"post",
url"/../modules/comment.php",
datadataString,
success<span style="color: #007700": function() {
$('div#comment_list').html("<div id='message'></div>");
$('#message').html("<h2 style='text-alig:center'>Your comment has been submitted!</h2>")
.hide()
.fadeIn()
}
});
return false;
});
});
</script>
?>
Działa dobrze... tylko... jak wysyłać za pomocą AJAXa inne zmienne? Takie które nie pochodzą z pól formularza?