I’m trying use jquery ui tabs together with js and mvc3.
<div class="demo">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Tab One</a></li>
<li><a href="#tabs-2">Tab Two</a></li>
</ul>
<div id="tabs-1">
<p> </p>
</div>
<div id="tabs-2">
<p> </p>
</div>
</div>
</div>
JsFile
function GetTabData(xdata) {
$.ajax({
url: ('/Home/GetTabData'),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ id: xdata }),
success: function (result) {
alert("OK !");
},
error: function () { alert("error"); }
});
}
MVC3
public ActionResult GetTabData(string xdata)
{
data = fetch data and return to the calling script
return PartialView("_TabDataPartial", data);
}
So the question will be pretty basic, how to bind js GetTabData() call with TabOne and TabTwo
Thanks.
You could take advantage of HTML5 data attributes and define your links in the following way:
Then in your js just bind the on click event to do the following: