Home > Web Front-end > JS Tutorial > body text

jquery plug-in regularly queries the number of pending tasks_jquery

WBOY
Release: 2016-05-16 16:50:22
Original
1265 people have browsed it

Usage:

Copy code The code is as follows:

$("#todo_tip" ).pull_todo_count();

Background return value

Copy code The code is as follows:

{"todo_count":3 }

js file

Copy code The code is as follows:

(function ($) {
var element;
$.fn.pull_todo_count = function () {
var a = $('0 pending applications');
a.attr("href", "/process/todo_list");
a.appendTo($(this));
$(this).hide();
element = $(this);
timerRequestData();
};
function timerRequestData() {
$.ajax({
} url:'/pull_todo_count',
type:'get',
data:nu ll,
dataType:'json',
success:function(data){
var count = data["todo_count"];
console.log(count);
if(count > 0){
                                                                                                                                                                                                           .        element.hide();
}
                                                                                                                                                                    
Template html code





Copy code
The code is as follows:

{% if user.is_authenticated %}

< ;span id="todo_tip" style="display: none;"> {% endif %}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template