Ajax帖子在localhost中工作,但不在godaddy服务器中

时间:2016-10-19 06:04:26

标签: ajax

这个ajax帖子在localhost中工作,但不在godaddy服务器中。我不知道如何解决这类问题。请让我知道如何纠正这个问题。

Ajax在许多地方都不起作用。本地所有文件都工作正常。

我是php的新手。任何人都可以帮我修复这个错误吗?

先谢谢

$sql = "
  SELECT *
  FROM profile_img
  WHERE user_id = ?
  ORDER BY ? DESC LIMIT 1
  ";
  if ($stmt = $con->prepare($sql)) {
        $stmt->bind_param("ss", $user_id, `id`);
        $stmt->execute();
        if (!$stmt->errno) {
            // Handle error here
        }
        $stmt->bind_result($id, $user_id, $profilePic);

        $pics = array();
        while ($stmt->fetch()) {
            $pics[] = $profilePic;
        }

        echo '<img id="home-profile-pic" src=" '.$profilePic.'">';
  }

我的PHP代码是:

function advanced_addTopic(cid) {    
      $.ajax({
            url: "assets/php/checkSubtopicStatus.php", // Url to which the request is send
            type: "POST",             // Type of request to be send, called as method
            data: {'cid':cid}, // Data sent to server, a set of key/value pairs (i.e. form fields 
            success: function(data)   // A function to be called if request succeeds
    {
                  if(data==="True"){
                        $("#subtopicDiv").html($("#subtopicDiv"+cid).html());
                    $("#advanced_testid").val(cid);

                var hiddenCourse=$("#createTest").attr('class');
                $("#courseHidden").val(hiddenCourse);
                   $("#advanced_addquestionModal").modal('show');
               $("#subtopic").focus();
               $("#question").focus();
                var tempVal=$("#getID").text(); 
                    $("#advanced_courseHidden").val(cid);
                } else {
                    alert("Create subtopics to insert questions!");
                }


      }
        });

&GT;

0 个答案:

没有答案