I am new to codeigniter , I am trying to call a controller on AJAX call sucess... I tried to search stackoverflow but i didn't get what i needed..
Form in my view
<form onsubmit="categorysearch()" method="GET">
<label for="username">Category : </label>
<select id="category" name="category">
<option value="android">android</option>
<option value="iphone">iphone</option>
<option value="windowsphone">windowsphone</option>
<option value="blackberry">blackberry</option>
</select>
<input type="submit" name="searchkeywordsubmit" title="Search" id="searchkeywordsubmit" />
</form>
When the form is submitted the below java script is executed.
JavaScript in my View
function categorysearch()
{
var categorykeyword = document.getElementById("category").value;
alert("Category keyword is " + categorykeyword);
$.ajax({
type: "GET",
async: false,
//dataType: "json",
url: "http://localhost/2009074/index.php/rest/resource/categorysearch/category/" + categorykeyword + "",
success: function(data)
{
alert("Returned data is " + data);
// i want to call the constructor here with the returned data
//$("body").html(data);
//$('body').append(output_string);
},
error: function(data)
{
alert("error is " + data);
}
});
}
AJAX call works successfully , I can see the returned data in the alert (Returned data is JSON encoded)
Now i want to call another controller with the recieved data ... Please help me to figure this out