AJAX表单POST请求-HTML表单POST/Submit with AJAX/Javascript示例/教程
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AJAX表单POST请求-HTML表单POST/Submit with AJAX/Javascript示例/教程相关的知识,希望对你有一定的参考价值。
function makePOSTRequest(url, parameters) { if (window.XMLHttpRequest) { // Mozilla, Safari,... // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { } catch (e) { try { } catch (e) {} } } alert('Cannot create XMLHTTP instance'); return false; } } function alertContents() { //alert(http_request.responseText); document.getElementById('myspan').innerHTML = result; } else { alert('There was a problem with the request.'); } } } function get(obj) { var poststr = "mytextarea1=" + encodeURI( document.getElementById("mytextarea1").value ) + "&mytextarea2=" + encodeURI( document.getElementById("mytextarea2").value ); } </script> <form action="javascript:get(document.getElementById('myform'));" name="myform" id="myform"> <textarea id="mytextarea1">my test 1 2 3
以上是关于AJAX表单POST请求-HTML表单POST/Submit with AJAX/Javascript示例/教程的主要内容,如果未能解决你的问题,请参考以下文章
解决YII提交POST表单出现400错误,以及ajax post请求时出现400问题
通过html表单方式提交数据(可以指定get和post)和ajax方式请求的原理是一样的吗?