Jquery $ .post到外部URL

时间:2014-07-30 18:48:40

标签: javascript php jquery html

所以我有一个本地站点运行并将表单发布到我的Web服务器,但是我想要一个表单上的反馈,告诉使用表单的人。

例如,如果有人登录,然后他们退出时会告诉他们他们登录的时间:

 <form action="http://www.example.com/signout.php" method="post" name="signoutForm">
      <input type="text" name="firstname" id="ofname" autocomplete="off" required><br>
      <div id="feedback"></div>
      <input type="submit">
 </form>

 <script>
      $('#ofname').keyup(function() {
           //ofname is the two id for the check signout; o for out
           $.post('http://www.example.com/checksignout.php', { 
                firstname: document.signoutForm.firstname.value
           },
           function(result) {
                $("#feedback").html(result);
           }
      });
 </scipt>

但我猜jquery不能像跨域请求一样吗?有办法解决这个问题吗?

0 个答案:

没有答案