Phonegap Jquery AJAX帖子:500(内部服务器错误)

时间:2016-07-31 07:49:13

标签: php ajax cordova

我正在构建一个phonegap应用程序并使用jquery ajax从服务器获取数据许多其他页面使用相同的代码工作正常但是有一个页面有一些错误我尝试了所有其他可能的东西但是无法使其工作请帮助我。下面是我的jquery和php代码:

adiddata ="adid="+viewadidtemp+"&address=test";
         $.ajax({
                            type: "GET",
                            url: 'http://www.xxxx.com/cocou-server/data/view-ad.php',
                            data: adiddata,
                            crossDomain: true,
                            cache: false,
                            beforeSend: function(){ },
                            complete: function() {  },
                            success: function(data){

                                     $$(page.container).find('.page-content').html(data);
                                      tempname = $$(page.container).find('#adxxxmka').html();
                                      $('body .center').html(tempname);

                                     myApp.swiper('.swiper-4', {
                                                                  pagination:'.swiper-4 .swiper-pagination',
                                                                  spaceBetween: 2,
                                                                  preloadImages: false,
                                                                  lazyLoading: true
                                                                });

                            }
                            });

Php Code

<?php 

header('Access-Control-Allow-Origin: *');  

include('../config.php');


if ($_SERVER["REQUEST_METHOD"] == "GET") {


$id    = trim($_GET["adid"]);

mysqli_query($conn, "UPDATE ads SET views = views+1 WHERE id=".$id."");

$query = mysqli_query($conn, "SELECT * FROM ads WHERE id='".$id."'");

if(mysqli_num_rows($query) > 0){

  while($row = $query->fetch_assoc()) { 



   $title = $row['title'];
   $category = $row['category'];
   $description = $row['description'];
   $price = $row['price'];
   $location = $row['location'];
   $city = $row['city'];
   $id = $row['id'];
   $time = $row['created_at'];
   $views = $row['views'];
   $userid = $row['user_id'];



  }}}


$userinfo = mysqli_query($conn, "SELECT * FROM users WHERE id='".$userid."'");  

 while($rowuser = $userinfo->fetch_assoc()) { 

   $fullname = $rowuser['fullname'];
   $number = $rowuser['number'];
   $jointime = $rowuser['datetime'];

 }

  ?>`

错误

GET http://www.xxxx.com/cocou-server/data/view-ad.php?adid=10&_=1469954186862 net::ERR_BLOCKED_BY_CLIENT

0 个答案:

没有答案