خرید بک لینک

Vote count: 0

I have trying to make ajax call with two parameters - number + date. Currently the error that I got is

Waing: date_format() expects parameter 1 to be DateTimeInterface, boolean given in...

This is the html part

<div class="textBox col-md-3 form-group">
    <div class="input-group input-append" id="">
        <input type="text" value="" maxlength="100" name="searchBox" placeholder="Number" class="form-control" id="search">
        <span class="input-group-addon add-on"><span class="glyphicon glyphicon-search"></span></span>          
    </div>
</div>   
<div class="form-group col-md-3">           
        <div class="input-group input-append date" id="dateRangePicker">
            <input type="text" class="form-control" name="date" placeholder="Date"/>
            <span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
        </div>
</div>  
<input type="submit" value="Search" class="searchBtn" /><br />    

Them this is the ajax part

$(document).ready(function(){

function showLoader(){

    $('.search-background').fadeIn(200);

}

function hideLoader(){

    $('#sub_cont').fadeIn(1500);

    $('.search-background').fadeOut(200);

};

$(".searchBtn").click(function(){

    showLoader();
    $('#sub_cont').fadeIn(1500);      
    $("#content #sub_cont ").load("getData.php?q=" + $("#date").val() + "&val=" + $("#search").val(), hideLoader());
});

and this is the getData.php

  include 'db.co.php';
   $pdo = Database::coect();

   $rec = $_REQUEST['val'];
   $q = date_create($_REQUEST['q']);
   $date = date_format($q, 'Y-m-d');

   if($date && $rec) {
        // query the database

If I remove this part q=" + $("#date").val() + which is for the date and leave search only by number there is not a problem and I got results. But I want to be able to search number for particular date.

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 12 اسفند 1394 ساعت: 17:55

صفحه بندی