0

I am building a phonegap app and using jquery ajax to get data from server many other pages working fine with same code but there is some error with one page i tried all other possible things but couldn't make it work please help me. Below is my jquery and php code:

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'];

 }

  ?>`

Error

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

0 Answers0