Javascript jqueryajax表单用于上传图像&;递交表格及;在MySQL数据库中保存值
我有一个HTML表单,通过jquery提交。$ajax() 表格必须: 1通过错误检查将图像上载到目录 2将图像路径保存到mysql数据库 三。插入其他2个表单值:输入+选择DB的值 4警报-如果图像和值都已成功上载并提交到DB,则表单提交时成功 我厌倦了尝试使用JSON:Javascript jqueryajax表单用于上传图像&;递交表格及;在MySQL数据库中保存值,javascript,jquery,mysql,json,ajax,Javascript,Jquery,Mysql,Json,Ajax,我有一个HTML表单,通过jquery提交。$ajax() 表格必须: 1通过错误检查将图像上载到目录 2将图像路径保存到mysql数据库 三。插入其他2个表单值:输入+选择DB的值 4警报-如果图像和值都已成功上载并提交到DB,则表单提交时成功 我厌倦了尝试使用JSON: $.ajax({ url: 'submit.php', type: 'POST', data: data, cache: false, dataType: 'json', processData: false, // Don
$.ajax({
url: 'submit.php',
type: 'POST',
data: data,
cache: false,
dataType: 'json',
processData: false, // Don't process the files
contentType: false, // Set content type to false as jQuery will tell the server its a query string request
success: function (data, textStatus, jqXHR) {
// lots of bullshit code
}
});
有新的完整工作代码吗?哪些可以完成这些任务?
我已经发布了两个问题,寻求对JSON的帮助,但似乎没有人同意,正在与JSON作斗争
////////////////////////HTML表单代码///////////////////////////
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form name="fb_form" id="fb_form" method="post" action="" enctype="multipart/form-data">
<table class="sm" border="1px solid #CCCCCC">
<tr>
<td><strong>Facebook</strong></td>
<td><input type="file" name="fb_icon" style="border: solid 1px #90D8CF;"
placeholder="Upload Image"></td>
<td><input type="text" name="fb_link" style="border: solid 1px #90D8CF;"
placeholder="Paste redirect link"></td>
<td>
<select name="show_fb" class="myselect">
<option value="">---Select---</option>
<option value="1">Show</option>
<option value="0">Hide</option>
</select>
</td>
<td>
<button class="myButton" type="submit" id="fb_submit">UPDATE</button>
</td>
</tr>
</table>
</form><!--------FB Form ends here------------>
</body>
</html>
$filename_wpath = $imagepath;
$fb_link = $_POST['fb_link'];
$show_fb = $_POST['show_fb'];
$sql = "INSERT INTO `tblbasicheader`(fldFB_image, fldFB_link, fldHideShow)
VALUES('$filename_wpath','$fb_link','$show_fb')";
mysqli_query($db_conx, $sql);
猜猜看,里面应该有什么好代码:$.ajax();
作为一名代码斗士,我提前向你表示感谢:)一个简单的谷歌搜索让我使用jQuery实现了这一点 注:如果谷歌找不到它,你可能是搜索错了