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')
}
精彩评论