Bahman
Bahman

Reputation: 19

My ajax doesn't work in live()

I have a link in my page and I wrote in it's onclick() event to show me a div that contain a date input text named "datepicker0" and also I have a div id ="bContent" below this input text.

Now I wrote below script and I want to apply date Filter on my data in "bContent", but it doesn't work! Appreciate any help please...

$('#datepicker0').live('focus', function() {
    $(this).datepicker().datepicker('show');
    true;
 })
 $('#datepicker0').live('change', function() {
    ShowMathesByDateFilter($(this).val());
 })

and ShowMathesByDateFilter() Function is :

function ShowMathesByDateFilter(Fdate)
{

  if (Fdate=="")
  {
  $("#bContent").html('<div class="bContent" dir="rtl"> no result are fond! </div>');
      return;
  }
  else
  {
      $.ajax({
          url:'/includes/GetMtch.php',
          data:"Fdate="+Fdate,
          success: function(data){
              //alert(data);    // this is work 
              $("#bContent").html(data);   //but this line doesn't work.
          }
      })
  }
}

Upvotes: 1

Views: 163

Answers (1)

CodeToad
CodeToad

Reputation: 4734

what version of jquery are you using? live is depreciated as of jquery 1.7: http://api.jquery.com/live/

try using 'on' instead of live: http://api.jquery.com/on/

I agree with charlietfl's comment. There seems to be an issue with this line:

$(this).datepicker().datepicker('show');

Upvotes: 1

Related Questions