[英]how to user Json Value in anchor tag data attribute?
我有一个锚标记,用于在其data-search_type属性中存储“搜索类型”。
在锚标记上,$ .post ajax方法使用此值基于数字搜索数据,但是如果您正确查找json中的“”(双引号),则data-search_criteria将“ [”存储为值,忽略其余数据。
所以我的问题是如何使此数据可用于$ .post方法?
<a class="showresult" data-search_type = "Search by Cost" data-search_criteria="["0","1"]" href="#">Open Search</a>
将包含双引号的“替换为单引号”
<a class="showresult" data-search_type = "Search by Cost" data-search_criteria='["0","1"]' href="#">Open Search</a>
使用"
来表示一个"
在由分隔的属性值的字符"
字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.