我有这个未定义的值,它说在 javascript 控制台上我的函数有什么问题?
我在这里要做的是,当我单击按钮时,它会将隐藏的值提交到我的数据库。提交值后它将淡出。
下面的jQuery
// AJAX/JQUERY FORM
$(function() {
$(".videoThumbS").click(function() {
var test = $("#v_w_id_value").val();
var dataString = test;
if(test=='') {
alert("Please Select Video");
} else {
$.ajax({
type: "POST",
url: "api.php",
data: dataString,
cache: false,
success: function(html){
$(".videoThumb4").fadeout();
$(".videoThumb4").hide();
}
});
} return false;
});
});
下面的表格
<form method="post" action="">
<input type="hidden" name="v_w_id" value="UOIDKSJLKH" id="v_w_id_value" />
<input class="videoThumbS" onClick="ALKJKLJLKMNF" type="button" name="selectSel" value="Select" id="selectbut" />
</form>
为什么我总是这样?下面的api.php
<?php
include ( 'class/conn.php' );
if( isset( $_POST['selectSel'] ) ) {
$v_watch_id = $_POST['v_w_id'];
$selected_videos = mysql_query( "INSERT INTO s_vids VALUE('', '$v_watch_id', NOW() )" ) or die ( mysql_error() );
/* VIEW RECORDS */
$result = mysql_query("SELECT * FROM s_vids"); //query
$array = mysql_fetch_row($result); //fetch result
echo json_encode($array);
}
?>