Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all i followed one link and i did not understand where to write JQuery

Link[^]

Can any one tell me?
Posted

1 solution

All you need to do is refer jQuery file in script tag and then access the Action methods written in Controller class via jQuery.

Here, have a downloadable sample application explaining the same: JQuery AJAX with ASP.NET MVC[^]
 
Share this answer
 
Comments
VJ Reddy 8-Jun-12 4:24am    
Good answer. 5!
Sandeep Mewara 8-Jun-12 4:26am    
Thanks VJ.
P_A_1 8-Jun-12 4:48am    
Hi sandeep
Can u tell me that
<script type="text/javascript" src="../../Scripts/jquery-1.5.1.js">
var url = "/Monitor/Test/GetDateTimeString";
$.get(url, null, function(data) {
$("#getDateTimeString").html(data);
});
</script>

where should we write this tag? I mean Index.cshtml(It is a view for my test controll) or in _viewStart.cshtml?

I tried in two but not getting answer...
Sandeep Mewara 8-Jun-12 4:57am    
Did you download the sample application? Did you went through?

Add the script tag in your View (Index.cshtml should do). Write the action method accessed in JS in Controller. (GetDateTimeString in Controller)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900