0
我想學習一種方法通過ajax json發送數據到經典asp asp頁面已被json成功調用,但問題是數據無法返回側,因此數據庫無法根據修訂後的排序來修改如何獲取數據使用經典ASP從ajax json post
前側
<script>
$(document).ready(function(){
$("#sortable").sortable({
update: function(event, ui) {
alert(ui.item.index());
alert(ui.item.attr("id"));
var data={
'sort':ui.item.index()
}
$.ajax({
url: 'work.asp?action=update,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
dataType: "json",
error: function (xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
},
success: function(){
alert("success");
}
});
}
});
});
</script>
背面我用傳統的ASP 但我無法獲得數據 數據我怎麼能做到嗎?
<%
Set conn = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("wawaaddatatable.mdb")
conn.Open "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath
if request.QueryString("action")="update" then
Response.ContentType = "application/json"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "Select * From images ",conn,1,3
rs.addnew
rs("sort")=request.form("sort")
rs("upload_date")=date()
rs("filename")="abc.jpg"
rs.update
rs.close
end if
%>
感謝您的幫助! –