tags:

views:

32

answers:

1

Hello,

I am fetching value using jQuery .get() like this

    $.get('clientarea.php', function(data) {
      var Val = $('#abc', data).val();
       if (this.val() == 'YES') {
         // do this
        }
        else {
        // do that
        }
    });

Using .get() I want to compare value of #abc [whether 'YES' or 'NO'] & then use conditional command to define further action.

But I am doing something wrong with above script. can anybody correct me.

Thanks

+2  A: 

You probably want:

$.get('clientarea.php', function(data) {
    var val = $('#abc', data).val();
    if (val == 'YES') {
        // do this
    }
    else {
        // do that
    }
});
Caleb
This is exactly what I was going to say...
JKirchartz
Thanks... worked perfect
MANnDAaR