Jump to content

Not working in IE


selenin

Recommended Posts

I wanted to test what I wrote and I saw that my jquery funtion is not working in Internet Explorer, (Firefox and Opera fine). The problem is a foreach call in the php, I can only see the last one of the call not each one, that's my javascript code:

 

function lookup2(grabberString) {

 

if(grabberString.length == 0) {

 

// Hide the suggestion box.

 

$('#suggestion').hide();

 

} else if(grabberString.length > 2) {

 

$.post(MELODYURL2+'/ajax_grabber.php', {queryString: ""+grabberString+""}, function(data){

 

if(data.length >0) {

 

$('#suggestion').show();

 

$('#autoSuggestions').html(data);

 

}

 

});

 

}

 

} // end ajax grabber

 

that's my template code:

 

          <td><input name="video_title" type="text" value="{$smarty.post.video_title}{$movie_title}" size="40" class="inputtext" id="grabberString" {if $smarty.const._SEARCHSUGGEST == 1}onkeyup="lookup2(this.value);" onblur="fill();" autocomplete="off"{/if}  /> 
			<div class="suggestionsBox" id="suggestion" style="display: none;">
				<div class="suggestionList" id="autoSuggestions">
				</div>
			</div>  

 

and that's my ajax_gabber.php code:

 

	if(strlen($queryString) >= 3)
{
	$num_res = 0;
	if(strlen($queryString) > 3)
	{
		$sql	 = "SELECT uniq_id, year, video_title FROM pm_videos 
					WHERE MATCH(video_title) 
					AGAINST ('$queryString') AS score ORDER BY score ASC LIMIT 10";
		$query	 = @mysql_query($sql);
		$num_res = @mysql_num_rows($query);
	}
	if($num_res == 0)
	{
		$query = @mysql_query("SELECT year, video_title, uniq_id FROM pm_videos WHERE  video_title LIKE '%$queryString%' LIMIT 10");
	}

	if($query)
	{
		while($result = mysql_fetch_array($query))
		{
			$output .= '<li onClick="fill(\''.$result['video_title'].' '.$result['year'].'\');">';

			if (_THUMB_FROM == 2)	//	Localhost
			{
				$output .= '<img src="'. show_thumb($result['uniq_id']) .'" width="32" align="absmiddle" style="margin: 1px 4px;" alt="'.$result['video_title'].' '.$result['year'].'" />';
			}
			$output .= '<a href="'. grabberlink($result['uniq_id'], $result['year'], $result['video_title']).'" title="'.$result['video_title'].' '.$result['year'].'">'.fewchars("".$result['video_title']." (".$result['year'].")", 35).'</a>';
			$output .= '</li>';
		}
	} 
	else 
	{
		$output = $lang['search_results_msg3'];
	}
}
}
echo $output;
$search->setsearchname($_POST['queryString']);
$results = $search->results ();
//var_dump($results);
$i = 0;
foreach ($results as $res) {

    echo "<li> <a href='suggest.php?mid=".$res->imdbid()."'>".$res->title()." (".$res->year().")</li>";
    $i++;
    if ($i > 11) break;
}
exit();

 

Now the problem is in IE that the foreach in ajax_grabber.php is not working, it shows only the last one and even that one not proper and the code above is ignored...

 

$i = 0;
foreach ($results as $res) {

    echo "<li> <a href='suggest.php?mid=".$res->imdbid()."'>".$res->title()." (".$res->year().")</li>";
    $i++;
    if ($i > 11) break;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.