程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Django web development and the stories of bugs

編輯:Python

Week1: About Django+LayUI Frame import ajax The reason for the failure

The template used directly, so I didn't go through many details completely , Writing a project is basically about finding out where to use it ,ajax Need to use jquery, But I followed the online tutorials for two days, but I couldn't get out , The code is OK, but open the browser to debug 11 The red circle is really deadly , To see a Blog be supposed to jquery Version problem , I found that …… I didn't import this package at all …… The case was solved, but I couldn't laugh or cry

The import code is as follows , I was really stupid to cry , It's over because of addiction bug Those who forget to open a party branch will almost be “ Skin picking ”

WEEK1: About LayUI Layout

The first N Second doubt life “ Why not use the framework that is no longer updated ” Sobbing , Just craving the table export function leads to learning a whole framework again , It's been four or five days since I added, deleted, modified and checked no tutorials

  1. About table position centering
<div >
<!-- Add here LayUI Form plug-in -->
<div>
  1. About adding new users , Delayed page Jump js sentence ( I have to say from c++ To python Until then js, Admire your own “ sentimental ”)
layui.use(['form'], function () {

var form = layui.form,
layer = layui.layer,
$ = layui.$;
// Monitor submission 
form.on('submit(saveBtn)', function (data) {

var index = layer.alert(JSON.stringify(data.field), {

title: ' Final submission information '
}, function () {

// Submit the information to the background 
$.ajax({

type:"post",
dataType:'html',
headers:{
'X-CSRFToken': "{
{ csrf_token }}"},
data:JSON.stringify(data.field),
contentType:'application/json',
url:"{% url 'MyAdmin:do_user_add' %}",
error:function(XMLHttpRequest,textStatus,errorThrown){

layer.msg(' Add failure ');
layer.msg(XMLHttpRequest.status+XMLHttpRequest.readyState);
},
success:function(data){

layer.msg(' Add success ',{
icon:1,time:3000,shade:0.4},function() {

location.href = "/admin/admin_userInfo/";
});
}
});
// Turn off the pop-up layer 
layer.close(index);
var iframeIndex = parent.layer.getFrameIndex(window.name);
parent.layer.close(iframeIndex);
});
return false;
});
});

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved