我想用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();
像这样发帖;
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");
$.ajax({
type: 'post',
url: 'http://some.com/services/service.php',
data: { date: dateval, hour: hourval, minute: minuteval },
success: function (data) {
//response..
}
});