我正在尝试制作一个javascript bookmarklet,它将使用HTTP POST方法从我的浏览器向我的php表单发送数据.我似乎无法让它工作......有人可以看看,告诉我为什么请?
var xhr = new XMLHttpRequest();
var params="v=66b12127";
xhr.open("POST", "http://google.com/index.php", true);
xhr.onreadystatechange = function() {
if(this.readyState == 4) {
window.alert("works");
}
}
xhr.send(params);
Run Code Online (Sandbox Code Playgroud)
在书签格式:
javascript:var xhr=new XMLHttpRequest();var params="v=66b12127";xhr.open("POST","http://google.com/index.php",true);xhr.onreadystatechange=function(){if(this.readyState==4){window.alert("works");}}xhr.send(params);
Run Code Online (Sandbox Code Playgroud)