Jquery,seajs Asynchronous Flush, clone

Source: Internet
Author: User

Define (function (Require, exports, module) {
var $ = require ("jquery")
Exports.getmoredata = function (Courseminetemplate_div, currentpage,
PageSize) {
$.post ("/outside/web/course/list.htm", {
Currentpage:currentpage,
Pagesize:pagesize

}, function (data) {
if (Data.header.flag = = 1 && data.content! = null) {
var pagination = data.content.pagination;
var pagecount = Pagination.pagecount;
var nextPage = pagination.currentpage + 1;
$ ("#mine_course_show_page_num"). attr ("value", nextPage);
var courses = data.content.courses;
if (Currentpage==pagecount) {
$ ("#bt_more_mine"). Hide ();
}
if (courses! = NULL && courses.length! = 0) {
for (var i = 0; i < courses.length; i++) {
Processminecourse (Courseminetemplate_div, data,
Courses[i]);
}
} else {

}
}

}, "JSON");

}
/** assembly with my participation in the course * */
function Processminecourse (courseminetemplate_div_div, data, course) {
var clonediv = Courseminetemplate_div_div.clone (true);
Clonediv.find ("#course_pic"). Find ("a"). attr ("href", "# # #");
Clonediv.find ("#course_image"). attr ("src", course.cover);
Clonediv.find ("#mine_major_name"). HTML (course.majorname);
Clonediv.find ("#course_name"). HTML (course.name);
Clonediv.find ("#mine_grade_name"). HTML (course.gradename);
Clonediv.find ("#course_operate_time"). HTML (
Formatedatesimple (Course.operatetime));

if (Course.metavalue = = "Course") {
Clonediv.find ("#buy_quantity"). HTML ("0");

} else if (Course.metavalue = = "Commodity_course") {
Clonediv.find ("#buy_quantity"). HTML (course.statistics.buyQuantity);
Clonediv.find ("#course_questionQuantity"). HTML (
course.statistics.questionQuantity);
Clonediv.find ("#course_notesQuantity"). HTML (
course.statistics.notesQuantity);

}

Courseminetemplate_div_div.before (CLONEDIV);
Clonediv.attr ("Style", "Display:block");
}

/** Time Format Conversion * */
function Formatedatesimple (date) {
Date = Date.split ("") [0];
return date;

}

})

Seajs.use (["jquery", "Teacher_course_mine_achieve"],function ($,teacher_course_mine_achieve) {

/** * Load Courses related to yourself * *
$ ("#bt_more_mine"). Click (Function (event) {
var courseminetemplate_div=$ ("#mine_teach_con");
var currentpage=$ ("#mine_course_show_page_num"). Val ();
var pagesize=5;
Teacher_course_mine_achieve.getmoredata (courseminetemplate_div,currentpage,pagesize);

});

});

Jquery,seajs Asynchronous Flush, clone

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.