Jquery – Strongly-typed partial view is not loading from jQuery function on radio button click

asp.net-mvcjquery

I have two strongly-typed partial views (Developers list and Testers list) and the respective views are Developers.ascx and Testers.ascx

Now I want to load one partial view based on the radio button selected.
The below code is not loading the URL that I specified on radio button change.

Code Snippet:

$(':radio').click(function() {

alert(this.value);
var url = '/Home/Developers/';
if (this.value == '2') {                 
     url = '/Home/Testers/';
}

 $(".Inquiries").load(url);

});

I would appreciate if anyone can provide a code snippet to load strongly-typed partial view from jQuery.

Thanks

Rita

Best Answer

You code sample worked fine for me, I think the problem is either you need to add it inside of a document ready function or it might be you need to include the file name

$(document).ready(function(){
 $(':radio').click(function() {
  alert(this.value);
  var url = '/Home/Developers/Developers.ascx';
  if (this.value == '2') {
   url = '/Home/Testers/Testers.ascx';
  }
  $(".Inquiries").load(url);
 });
})