0

Hi to all people :D i have a problme with method ajax for jquery, I dont know what happend xD

I am use the ajax for a confirm, it is works fine until i send the url

if (confirmation) {
            $.ajax({
                type: "GET",
                url: "http://localhost/Bar/index.php",
                dataType: "json",
                data: {current: current_item, disp: disp},
                success:function() {
                 alert( "Data Saved");
                }
            });
        }else{
            return false;
        }
  • I already try

    • Cache to false.
    • With dataType jason and without it.
    • Urls relative or absolute.
    • Method $.get and $.post.
    • Type:post
    • I delete the other code and only leave alone the ajax.

I use the inspector for google chrome and the url is sended but not change or get the vars in the inspector i got this:

index.php   
styles.css  
jquery-1.9.1.js 
jquery-ui.js    
index.php?current=table_6&disp=available

but i cant obtain with get and not matter if i use method post or get my url always is index.php without variables i only can see with the inspector.

I have this for obtain the var:

if($_SERVER['REQUEST_METHOD']=='GET' && isset($_GET['current'])){*/
    $pos = $_GET['current'];
    echo $pos;
}

but only give me - without the comprobation for see the error:

 Notice: Undefined index: current in C:\wamp\www\Bar\index.php on line 4
 Call Stack
 #  Time    Memory  Function    Location
 1  0.0009  255448  {main}( )   ..\index.php:0

Thanks for any suggestion, regards :D

Alan Cordova
  • 161
  • 1
  • 18
  • no offence, bu i can't understand you. what is the problem again? – goodpixels Jul 26 '15 at 11:20
  • 1
    Why do you have comment-end characters at the end of the `if` line? Is the `if` commented out? – Barmar Jul 26 '15 at 11:21
  • 1
    see this line `if($_SERVER['REQUEST_METHOD']=='GET' && isset($_GET['current'])){*/` ... see how it ends with */ ... that looks wrong .. can you post more of your php file to see what you are doing wrong, there's no `index` anywhere in the very little you posted – Jaromanda X Jul 26 '15 at 11:22
  • read this: http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index – goodpixels Jul 26 '15 at 11:22
  • this is because i had the if commented but not matter if i have commented or not i can delete the validation and still not working. The entire code is in index.php, i want pass the var to the same archive index.php – Alan Cordova Jul 26 '15 at 20:52

0 Answers0