Why is my search code not working in Internet Explorer

I have the following code to search from a database, showing the result of returning to the page and showing them using jqgrid, my code works fine with firefox, but it doesn't work, i.e. when I use utf8 as arabic letters, I set both encoding and firefox to unicode (utf8)

its html code

first name: <input type="text" id="firstname" onkeydown="doSearch(arguments[0]||event)" value="" class="mytextbox" /> 

<button onclick="gridReload()" id="submitButton" style="margin-right:100px;" class="Buttons">search</button> 

my javascript code

function gridReload(){ 
    var name = jQuery("#firstname").val();

jQuery("#list2").jqGrid('setGridParam',{url:"<?php bloginfo('template_url'); ?>/post2.php?firstname="+firstname",page:1}).trigger("reloadGrid");

}

and my php code

if(isset($_GET["firstname"]))
 $firstname = $_GET['firstname'];

mysql_query ( "set names utf8" );

if($firstname!='')
 $where= "  firstname LIKE '$firstname%'"; 

$SQL = "SELECT id,firstname,lastname FROM  mytable ".$where." 
     ORDER BY $sidx $sord LIMIT $start , $limit";

 $result = mysql_query( $SQL ) or die(mysql_error());
$responce->page = $page;
     $responce->total = $total_pages;
     $responce->records = $count;
 $i=0;
 while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { 
     $responce->rows[$i]['id']=$row[id];
     $responce->rows[$i]['cell']=array(
     $row[id],$row[firstname],$row[lastname]);
     $i++; 
     }

 echo json_encode($responce); 

why it doesn’t work with ie (i teste with ie8), but it works with opera and firefox

thank

0
source share
1 answer

First of all, you have a problem with quotes in the string where you are using setGridParam. You probably mean

jQuery("#list2").jqGrid('setGridParam',
    {url:"<?php bloginfo('template_url'); ?>/post2.php?firstname="+firstname,
     page:1}).trigger("reloadGrid");

instead

jQuery("#list2").jqGrid('setGridParam',
    {url:"<?php bloginfo('template_url'); ?>/post2.php?firstname="+firstname",
     page:1}).trigger("reloadGrid");

url . -

jQuery("#list2").jqGrid('setGridParam',
    {url:"<?php bloginfo('template_url'); ?>/post2.php?firstname="
         +encodeURIComponent(firstname),
     page:1}).trigger("reloadGrid");

jQuery("#list2").jqGrid('setGridParam',
    {url:"<?php bloginfo('template_url'); ?>/post2.php?"+
         jQuery.param({firstname: firstname}),
     page:1}).trigger("reloadGrid");

firstname URL-.

- postData jqGrid. . jqGrid NOT, /, .

+1

All Articles