假设我有这个脚本:
$('.myDiv').click(function(){
$.getJSON('http://example.com/t.php', {
department: 'department',
manufacturer: ''
}
使参数的[manufacturer]值由以下内容表示的正确语法是什么:
<div class="myDiv" rel="brand=myBrand">Hello World</div>
如何通过div的关系定义manufacturer参数的值?
答案 0 :(得分:0)
你可以做到
$('.myDiv').click(function(){
$.getJSON('http://example.com/t.php', {
department: 'department',
manufacturer: $('div.myDiv').attr('rel')
}