[eluser]Nutan Lade[/eluser]
Sorry I forgoted to write the code for getObject.It is nothing but it checks the browser type and returns the msg.
function getObject(name) {
var ns4 = (document.layers) ? true : false;
var w3c = (document.getElementById) ? true : false;
var ie4 = (document.all) ? true : false;
if (ns4) return eval('document.' + name);
if (w3c) return document.getElementById(name);
if (ie4) return eval('document.all.' + name);
return false;
}
I just changed the code and used framework.
function ajaxSearchMovie(){
new Ajax.Request('/gadgets/searchMovie/a',
{
method:'get',
onSuccess: function(transport){
var response = transport.responseText || "no response text";
alert("Success! \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
}
<body>
<table>
<tr>
<td><input type="text" id="movieSearch" name="movieSearch" ></td>
</tr>
<tr>
<td><div align="center" id="searchResult" name="searchResult" style="font-family:Arial; font-size:12px; width:150px; border:#000000 solid 1px; “></div></td>
</tr>
</table>
</body>
gadgets.php
----------------------------------------------------------------------------------
class Gadgets extends Controller {
function Gadgets()
{
parent::Controller();
$this->load->helper('ajax');
}
function searchMovie(){
$results = “”;
$pat = $this->uri->segment(3);
$query = $this->db->query("SELECT * FROM movies_list WHERE movie_name LIKE ‘$pat%’ LIMIT 10");
foreach ($query->result() as $row)
{
$results = $results."<b>$row->movie_name</b><br />”;
}
return $results;
}
}
the above code is the code used in controller gadgets.php
these is the javascript code I used in gadgets_view.php file.
But I am getting the message "Something went wrong....."
Is that the controller is not writing any data back.If so where could be the problem.Please help me.Thanq in advance.