Page 1 of 1

XAMPP ajax request

PostPosted: 19. July 2018 11:17
by kepler
Hi,

In WordPress, I'm makin several calls with ajax. For example:

Code: Select all
$.ajax({
    type: "GET",
    url: ecl_url,
    data: {year: ano, age: 27, country: 'Ireland'},
    success: function(data){
        divn.innerHTML += data;
    }
});


This perfectly works. ecl_url echoes the data, and the url is correctly format. HOWEVER, in another ajax call, like this:

Code: Select all
            $.ajax({
            data: {'user': 'kepler','custom_img_size': custom_img_size,'show_outer': show_outer},
            type: 'POST',
            dataType: 'json',
            url: natal_url,
            success: function($answer) {
                document.getElementById('myReports').innerHTML += $answer.html;
                }
            });


natal_url is also correctly formated. But I not only get no error, I get no data!
This script echoes differently:

Code: Select all
...
      $html .= '</font></td></tr>';
      $html .= '</table>';
      $html .= "<br /><br />";
     
      echo json_encode(array(
        'html' => $html
      ));
      exit();



Any idea what's wrong? In a server online it all works - in XAMPP doesn't...

Kind regards,

Kepler

Re: XAMPP ajax request

PostPosted: 23. July 2018 08:52
by asprin
Could you open the browser console (usually F12) and see what you're getting back as response (usually shown under the "networks" tab)?

Re: XAMPP ajax request

PostPosted: 23. July 2018 10:16
by kepler
Hi,

Thanks for the reply. I get all the requests withh a 200 OK code.... I cant seem to find, however, nothing regarding the request I spoke...

Kind regards,

Kepler