Php 使用$.ajax jquery mobile发送和接收

Php 使用$.ajax jquery mobile发送和接收,php,ajax,jquery,jquery-mobile,Php,Ajax,Jquery,Jquery Mobile,我得到这个代码的错误,但它应该工作。我想将数据发送到loginck.php并获取服务器响应。有错误吗 <link rel="stylesheet" href="css/jquery.mobile-1.3.0-beta.1.css" /> <link rel="stylesheet" href="css/jqm-docs.css"/> <script src="js/jquery-1.7.1.min.js"></script> <scrip

我得到这个代码的错误,但它应该工作。我想将数据发送到
loginck.php
并获取服务器响应。有错误吗

<link rel="stylesheet"  href="css/jquery.mobile-1.3.0-beta.1.css" />
<link rel="stylesheet" href="css/jqm-docs.css"/>

<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jqm-docs.js"></script>
<script src="js/jquery.mobile-1.3.0-beta.1.js"></script>

我也有同样的问题,但找到了解决办法。您可以在php文件的顶部添加以下标题说明符>>

标题('Access-Control-Allow-Origin:');
标题('Access-Control-Allow-Methods:GET、POST、PUT')

你的错误是什么?控制台日志中有什么内容?我收到警报“不工作!”你能直接从浏览器调用
loginck.php吗?username=subin&password=passwordx
?您确定日志中没有任何内容吗?是的,我可以调用'loginck.php?username=subin&password=passwordx'。thr没有日志。请尝试使用jqm 1.3.2和jq 1.9.1,同时替换
窗口。用
$(文档)加载
。on('pageinit',函数{…})
    <div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
        <form action="#" method="post" autocomplete="off">
            <div style="padding:10px 20px;">
              <h3>Please sign in</h3>
              <label for="un" class="ui-hidden-accessible">Username:</label>
              <input type="text" name="username" id="un" value="" placeholder="username" data-theme="a" />

              <label for="pw" class="ui-hidden-accessible">Password:</label>
              <input type="password" name="password" id="pw" value="" placeholder="password" data-theme="a" />

              <button type="submit" name="submit" id="submit" value="submit-value" data-theme="b">Sign in</button>
            </div>
        </form>
    </div>
    $(window).load(function(e){
        $('#submit').bind('click', function(e)  {
            e.preventDefault();
            $.ajax({
                type       : "POST",
                url        : "loginck.php",
                crossDomain: true,
                beforeSend : function() {$.mobile.loading('show')},
                complete   : function() {$.mobile.loading('hide')},
                data       : {username : 'subin', password : 'passwordx'},
                dataType   : 'json',
                success    : function(response) {
                    //console.error(JSON.stringify(response));
                    alert(response);
                },
                error      : function() {
                    //console.error("error");
                    alert('Not working!');                  
                 }
            });     
        });
    });