Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have already declared a function using ajax but how can i call that function in my view page in mvc architecture. my code

var Master={};
Master.InitMaster = function () {
var MenCallAjax = {
url: Menu_Items_Url
, success: function (Result) {
console.log('Result', Result);
$("#accordion1").html("need to be designed");
}
, error: function (Err) {
console.log('Err', Err);
}
};
AjaxCallHelper.AjaxGet(MenCallAjax);
};

how to call these function in my view page??
Posted

1 solution

Instead of handling onload of the <body> element, jQuery suggests a bit different approach: $(document).ready(). Please see: https://learn.jquery.com/about-jquery/how-jquery-works[^].


In a typical script using jQuery, you call all your script functions from the function passed to $(document).ready(); it is especially important for the code installing some other event handlers.


If you want to use jQuery UI menu, you can use this: https://jqueryui.com/menu[^].


Also, there are many 3rd-party jQuery menu scripts, most typically, jQuery UI plug-ins: http://bfy.tw/19bX[^].


—SA
 
Share this answer
 

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