我有一个问题如何获取请求。我有this code:如何让http获取请求并隐藏请求的链接
HTML
<div id="test"></div>
<input type="text" id="url" name="url" placeholder="text" size="40px">
<br>
<input type="button" id="go" name="go" value="go">
JS
$(document).ready(function(){
$("#test").click(function(){
url=$("#url").val()
$.ajax({
url:"process.php",
type:"GET",
data:"url="+url,
success:function(result){
$("#go").html(result)
}
})
})
})
在process.php我做一个链接这种形式。
<?php
$url = $_POST['url'];
$link = file_get_contents("https://parsedurl.com/?url=".$url."");
$parse = json_decode($link, true);
$md = $parse['user_id'];
$nd = $parse['email_id'];
$pro = file_get_contents("http://domain2.com/complete?id=".$md."_".$nd."");
if($pro == 0){
echo "success";
}elseif (!$pro != 0) {
echo "error";
}elseif (!$pro) {
echo "link error";
}else{
echo "put a link";
}
?>
我需要GET请求http://domain2.com/
没有职位,但不重定向到该页面,并获得在我的网页的响应。
什么错误或问题? –
它使发布请求不GET GET – user3555881
不知道您是否在发布q后编辑了小提琴uestion,但它似乎正在执行** GET **请求。那么,至少发生在绑定click事件时设置正确ID:'$('#go')。click(...)'。 –