<input type='text' id='title' name='title' size="60" /><br/><br/>
<input type="submit" name="submit" value="提交" onclick="submitRequest();"/>
<br/><br/>
<label>结果:</label>
<input type='text' id='result' name='result' size="50" /><br/><br/>
<script type="text/javascript">
function submitRequest(){
var $dataInfo = "data=" + $("#title").val()
$.ajax(
{ type: "POST", url: "/post", data: $dataInfo, success: function(msg)
{
$('#result').val(msg)
}
});
}
</script>
前端 ajax的例子
最新推荐文章于 2024-07-12 15:31:17 发布