Я использую requirejs и в моем индексе у меня естьUncaught TypeError: Не удается прочитать свойство «Аякса» неопределенной
и В main.js У меня есть
require(["jquery","employeeManager","employeeData"], function ($,employeeManger,employeeData) {
alert("main.js funtion");
var main= employeeManger.loadStudentData();
return main;
})
and in employeemanger
loadStudentData : function(){
$.ajax({
//url:"http://localhost:63342/NewnodeJsProject/public/data/studentData.json",
url:"http://localhost:63342/NewnodeJsProject/public/data/studentData.json",
method:'get',
success:this.handlerData
})
}
я ЗАГРУЗКА зависимостей правильно .. то почему я получаю uncaught ошибку: не могу прочитать свойство «ajax» undefined
Почему вы ожидаете '$' в есть? – SLaks
define (["jquery-1.9.0.min", "handlebars"], function ($, handlebars) { var Employee_METHOD = {handlerData: function (resJSON) {var templateSource = $ ("# employee-template ") .html(), template = handlebars.compile (templateSource), studentHTML = template (resJSON); $ ('# mydiv') .html (studentHTML); console.log ($ (" # employee- шаблон ")) }, loadStudentData: функция() { $ .ajax ({ URL:" HTTP: // локальный: 63342/NewnodeJsProject/государственные/данные/studentData.json», метод: 'получить', успех: this.handlerData }) } }; –
это мой оригинальный код. где я использую requirejs и jqury –