[英]javascript form using POST method
我想用 javascript 發帖,我有 3 個數據。
如何使用這種形式的 javascript 發布 3 個值?
dateval = $('#tarih input.datepicker').val();
hourval = $('#scheduleHour').val();
minuteval = $('#scheduleMinute').val();
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "/app/" + @appId + "/volumes/" + obj.data("rowid") + "/scheduledPublish");
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "dateval");
hiddenField.setAttribute("value", result);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
$.ajax({
type: 'post',
url: 'http://some.com/services/service.php',
data: { date: dateval, hour: hourval, minute: minuteval },
success: function (data) {
//response..
}
});
像這樣發帖;
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "/app/" + @appId + "/volumes/" + obj.data("rowid") + "/scheduledPublish");
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "dateval");
hiddenField.setAttribute("value", dateval);
form.appendChild(hiddenField)
並像這樣從java獲取;
form.data().get("name value");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.