這是我的html code
我要傳一個hidden值給ajax
<form action="" method="post" name="<?php echo $number; ?>">
<input type="hidden" name="picurl" value="<?php echo $url_temp; ?>"/>
<input type="submit" value=" Comment_Submit "
class="comment_submit" id="<?php echo $number; ?>" />
</form>
<script type="text/javascript">
$(document).ready(function(){
$(".comment_submit").click(function(){
var element = $(this);
var Id = element.attr("id");
var test = $("#textboxcontent"+Id).val();
var dataString = 'textcontent='+ test + '&com_msgid=' + Id;
var dataVar = $("#picurl").val();
if(test==''){
alert("Please Enter Some Text");
}
else{
$.ajax({
type: "POST",
url: "insertajax.php",
data: {dataString, dataVar},
......
想請問為什麼dataString這個variable可以傳過去
但是dataVar卻無法傳過去
拜託版上大大了.....