php jquery无限极分类,jquery 、thinkphp商品无限极分类

运行中主要文件,仅限参考

HTML:

{$CONF['shopTitle']['fieldValue']}后台管理中心

var url="{:U('News/typeTree')}";

$(function () {

bindDB({ajaxurl:"{:U('News/typeTree')}"});

KindEditor.ready(function(K) {

editor1 = K.create('textarea[name="articleContent"]', {

height:'350px',

allowFileManager : false,

allowImageUpload : true,

items:[

'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',

'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',

'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',

'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',

'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',

'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|','image','table', 'hr', 'emoticons', 'baidumap', 'pagebreak',

'anchor', 'link', 'unlink', '|', 'about'

],

afterBlur: function(){ this.sync(); }

});

});

$.formValidator.initConfig({

theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){

edit();

return false;

},onError:function(msg){

}});

$("#articleTitle").formValidator({onFocus:"请输入文章标题"}).inputValidator({min:1,max:100,onError:"请输入100字以内文章标题"});

$("#catId").formValidator({onFocus:"请选择文章分类"}).inputValidator({min:1,onError: "请选择文章分类"});

$("#articleKey").formValidator({onFocus:"请输入关键字"}).inputValidator({min:1,max:80,onError:"请输入关键字"});

});

文章标题*
分类*

请选择

{$vo.catName}

是否显示*

checked />显示  

checked />隐藏

关键字*
内容*

{$list.newsContent}

js:

$(document).ready(function(){

function bindDB(options){

//alert(options);

var opt = options || {},

$bindDB = $(".bindDB"),

len = 0,

nameText = "";

if(!$bindDB[0]){$.error("对象不存在!");return false;};

len = $bindDB.length;

$(".bindDB").live("change",function() {

if(this.name && this.tagName == "SELECT")

{

var that = $(this);

//alert(that);

that.nextAll(".bindDB").remove();

len=$(".bindDB").length;

//alert(len);

if(/_/g.test(this.name)){

nameText = this.name.split("_")[0]+"_";

this.name = nameText+(len-1);

}else{

nameText = this.name+"_";

this.name = nameText+(len-1);

};

$.ajax({

url:url,

dataType:"json",

type:'post',

data:{id:$(this).val()},

timeout:5000,

error: function(error){

alert("网络超时!");

},

success: function(data){

//console.

//alert(data);

//var data = eval("("+data+")");

console.log(data);

var option = "";

$.each(data,function(k,v){

option+= ""+v.catName+""

});

that.after(""+option+"");

}

});

}

});

};

//bindDB();

window.bindDB = bindDB;

})

thinkphp:

public function typeTree(){

//获取商品分类信息

$catId=I('post.id');

$this->ajaxReturn($catId);exit;

$m = M('goods_cats');

$rs = $m->where('parentId='.$catId)->select();

echo  json_encode($rs);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值