开发者

Using rel=value inside of getJson

Let's say I have this script:

$('.myDiv').click(function(){
     $.getJSON('http://example.com/t.php', {
          department: 'department',
          manufacturer: ''
}

What is the correct syntax to have a parameter's[manufacturer] value be represented by something like this:

<div class="myDiv" rel="brand=myBrand">Hello World</div>

How can the开发者_StackOverflow社区 value of the manufacturer parameter be defined by the relationship of the div?


you can do

$('.myDiv').click(function(){
     $.getJSON('http://example.com/t.php', {
          department: 'department',
          manufacturer: $('div.myDiv').attr('rel')
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜