【发布时间】:2018-06-08 05:47:35
【问题描述】:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<body>
<h2>HTML Forms</h2>
<form name = "test_form">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="button" value="Submit" >
</form>
<p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p>
<script>
var url = "http://x.x.x.x:3001/createData"
var data ={
"productID": document.test_form.firstname,
"title": document.test_form.lastname,
};
var success_func = function(data){
//do what you want with the returned data
console.log("your data is succesfull posted")
};
$.post(url, data, success_func);
</script>
</body>
</html>
我没有通过任何事情,也只是调用其余 api 并发布数据,但我得到堆栈最大大小超出错误请帮助我
【问题讨论】:
-
删除提交按钮并在表单外创建一个新按钮或元素...在其上添加一个事件并继续您的任务。
-
将此
<input type="submit" value="Submit" >转换为此<input type="button" value="Submit" > -
好吧......你从来没有打电话给
fck......那它为什么会执行呢?你认为浏览器如何知道运行 fck -
除非你想暴露你的服务器,否则不要硬 cdoe ip 地址。
标签: javascript html css json api