我通過AJAX將表單發佈到ColdFusion操作頁面進行處理。但由於某種原因,我的處理頁面沒有看到我的任何表單值。無法通過AJAX訪問表單值
<cfoutput>
<!--- Javascript that updates the notes in the DB --->
<script>
$(document).ready(function() {
$('##notesForm').submit(function(event){
event.preventDefault();
ajaxAddNotes();
});
function ajaxAddNotes() {
console.log("ajaxAddNotes function called");
$.ajax({
type: "POST",
data: $('##notesForm').serialize(),
url: "../actionpages/add_notes.cfm",
cache: false,
contentType: false,
processData: false,
beforeSend: function(){
$('.loader').show();
},
complete: function(){
$('.loader').hide(3000);
},
success: function(data) {
console.log("File successfully sent.");
$("##addFileResponse").append("Note successfully added.");
PopulateNotesDIV();
},
error: function(data) {
console.log(data);
}
});
}
});
</script>
<form name="notesForm" id="notesForm">
<textarea class='expanding' tabindex="18" name="tech_notes" id="tech_notes" cols="100" rows="5" >#get_ticket.tech_notes#</textarea><br />
<input tabindex="0" type="submit" name="update-notes" id="update-notes" value="Update Notes" />
<input type="hidden" value="#url.ticketID#" name="ticket_id" id="ticket_id">
<div class="loader"><img class="loading-image" src="../images/loading.gif" /></div>
<div class="response" id="addFileResponse"></div>
</form>
</cfoutput>
這是我處理網頁上的代碼(我知道我還沒有cfqueryparam'd此查詢恰在此時測試。):
<cfdump var="#form#">
<!---Update Notes button was clicked so we now must update the notes section --->
<cfquery name="update_notes" datasource="#datasource#">
update closed_tickets
set tech_notes = '#form.tech_notes#'
where ticket_id = #form.ticket_id#
</cfquery>
'
PeterKA
它任務說:結構[空] –
和'POST'請求發送什麼參數/值,如果有的話? – PeterKA