views:

222

answers:

2

I have a code which accept a query and uses yahoo websearch to return a suggestion.Its working fine in FF and Chrome . but in IE it gives no result. can any one help me on this??

Here is the code:

$(document).ready(function() {

 $.ajax({
  type: 'GET',
  url: "dummyapi.php",
  data: {query: "yaho"},
  success: function(xml) { 
  alert($("Result",xml).text());
  /* do something here */ 
  },
  error: function(xhr, type, exception) { alert("Error: " + type); }
             });
});

dummyapi.php

$Squery = $_GET['query'];
$appid = "S8YhyGzV34HB2jaWxc9VsNIPqeeg0OwqV.WQ0IvF1lblZsUiFzlyEs12kVyH5_IT";
$u = "http://search.yahooapis.com/WebSearchService/V1/spellingSuggestion?appid=".$appid."&query=".$Squery;
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $u);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $xml = curl_exec($ch);
      curl_close($ch);
      echo $xml;
+2  A: 

It seems like you're missing the closing }); of $.ajax, except if it's not shown there.

cloudhead
I have that closing brackets in my program... but not working...
+1  A: 

Two quick things that are syntax errors:

  • Missing the closing }); of the ajax call (or document.ready, depending on how you look at it)
  • Missing the closing " of the $u variable.

Just tested the code with these things fixed and it is working for me on IE, FF, Chrome.

Paolo Bergantino
I have it correctly in my program.
i have the syntax corrected in my code. but doesn't works fine in IE. but no probelm wiht FF and chrome
do you have a syntax error in IE , in the bottom (status bar) ?
Haim Evgi