Reputation: 7153
i have an image:
<img onclick="Search()" alt="searchPage" style="vertical-align: middle;" height="17px"
src="../../Stylesheets/search.PNG" title="search" />
and javascript methode:
<script language="javascript" type="text/javascript">
function Search() {
alert("test-search");
var searchText = $("#txtSearch").val();
var queryString = "SearchText=" + searchText;
$.post("/Search/Search", queryString, callBackSearch, "_default");
}
</script>
how can i call action Search from SearchController? in my js methode its is jquery $.post is it? but i dont wanjt to use jQuery in my project.
please help me.
Upvotes: 0
Views: 3277
Reputation: 1038710
If you don't want to use any javascript you could create a simple form containing the textbox and a submit image button:
<% using (Html.BeginForm()) { %>
<%= Html.TextBoxFor(x => x.TxtSearch) %>
<input type="image" alt="searchPage" style="vertical-align: middle;" height="17px" src="../../Stylesheets/search.PNG" title="search" />
<% } %>
or if your view is not strongly typed as it should be you could use the following helper to generate the textbox:
<%= Html.TextBox("TxtSearch") %>
Upvotes: 1