如何在加载函数上使用ajax调用动态创建菜单 [英] how to dynamically create menus using ajax call on load function

查看:53
本文介绍了如何在加载函数上使用ajax调用动态创建菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用ajax声明了一个函数但是如何在mvc架构的视图页面中调用该函数。我的代码



var Master = {};

Master.InitMaster = function(){

var MenCallAjax = {

网址:Menu_Items_Url

,成功:函数(结果){

的console.log( '结果',结果); <无线电通信/>
$(#accordion1)。html(需要设计);

}

,错误:函数(错误){<登记/>
的console.log( 'ERR',ERR);

}

};

AjaxCallHelper.AjaxGet(MenCallAjax );

};



如何在我的视图页面中调用这些函数?

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??

推荐答案

(\"#accordion1\").html(\"nene to be designed);

}

,错误:function(Err){

的console.log( 'ERR',ERR);

}

};

AjaxCallHelper.AjaxGet(MenCallAjax) ;

};



如何调用这些函数n在我的视图页面??
("#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??


而不是处理< body>的 onload 元素,jQuery建议采用一种不同的方法:

Instead of handling onload of the <body> element, jQuery suggests a bit different approach:


(document).ready()。请参阅: https://learn.jquery.com/about-jquery/how-jquery-works [ ^ ]。
(document).ready(). Please see: https://learn.jquery.com/about-jquery/how-jquery-works[^].

在使用jQuery的典型脚本中,您可以从传递给

In a typical script using jQuery, you call all your script functions from the function passed to

这篇关于如何在加载函数上使用ajax调用动态创建菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆