I am using Jquery ajax method to call a controller from a view. The controller action method is successfully called, it retrieves data from the database and displaying the data in the respective view, but at the end the view is not generating its showing the same view.
Here is my Jquery code to call the action method.
<script type="text/javascript">
$(document).ready(function () {
$('#btn_Search').click(function (e) {
var category = $("#ddl_Category option:selected").text();
var location = $('#txtSource').val();
$.ajax({
url: "/Classified/GlobalSearch",
type: 'GET',
data: { searchcategory: category, Location: location },
success: function (data) {
alert("Hi");
},
});
});
});
</script>
It called to this action method.
public ActionResult GlobalSearch(string searchcategory,string Location)
{
//Connect to db and fetch data in form of List
return View(list);
}
At the end the data is setting in Global search view also. But the view is not coming.
To check the success of the call I have put a hi message:
Can anyone please suggest me what need to change?