$('#SaveProfile').bind("click", function(){

        var pass_entered = $('#pass_entered').val();;
        var access = false;

        //check for the password entered if correct



                access = $(e).val();

                if(access != true){
                    //if password is wrong notify user!!
                    alert('Password Entered is Incorrect Data cannot be Save');

                    //if password is correct save data
                    alert('Password Entered Matchec!!');




Can anyone help me how accept return values from $_GET with jquery ajax
my php file return a boolean variable access ...

Recommended Answers

All 4 Replies

success:function(e){ e is the return value from the php file

for example passProtectionCheck.php where you gonna gor through the get process
echo "Success"; from passProtectionCheck.php as you echo "Succes" is the return value of an ajax request try to alert(e); onsuccess of an ajax request then there will be a popup alert "Success" from the page

commented: well described +0

How can i store a return value on a variable?

success:function(e){ start from this line e is the return value
then store to variable like var access = e;

make (or) store your boolean variable value into an php array as follows

$out_val = array("result"=>'your value here');
echo json_encode($out_val);

and read this value in your script code by using Json.parse() as follows

                var actual = JSON.parse(e);


check it once by making changes in your php file as well as in script code

check whether the alert box gives your desired result or not

let me know the status after updating with the code above

happy coding

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.