1

I used to get my php-params within AJAX like this:

$.ajax({
    url: "php/loadPictures.php",
    ***data: { id: $_GET['id']},***
    dataType: 'json',

    success: function( data ) {...

As I changed to jQuery 3.x this doesn't work anymore and comes with an error. What else can I do? Thx for helping

xMen
  • 11
  • 4
  • There was never a jQuery version that provided request variables in such a notation. What you have posted here is a PHP superglobal variable, but without a PHP context (i.e. ``). You must have been confused by some copy-paste mistakes… – feeela Apr 17 '18 at 11:35
  • this is funny... cause it works exact like this. The url comes with "loadPicture.php?id=12324434" Maybe you're right and I got this snippet from a Helpdesk. But with jQuery 3.x its not working anymore – xMen Apr 17 '18 at 13:02

1 Answers1

1

Try this -

$.ajax({
        url:'php/loadPictures.php',
        type:'GET',
        async:false,
        cache:false,
        success: function (res) {
            console.log(res);
        }
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
kaushal agrawal
  • 360
  • 3
  • 21