Javascript 如何使用jquery从xmlhttprequest获取类属性
我试图编写一个代码,从xmlhttprequest获得的响应中提取“代码”。我已经走了这么远 我不熟悉javascript和jquery,我提取快照中显示的“AddDional25”之类代码的方法对吗?有更好的方法吗?我计划从snap中显示的数组中提取“代码”。试试看Javascript 如何使用jquery从xmlhttprequest获取类属性,javascript,jquery,ajax,arrays,Javascript,Jquery,Ajax,Arrays,我试图编写一个代码,从xmlhttprequest获得的响应中提取“代码”。我已经走了这么远 我不熟悉javascript和jquery,我提取快照中显示的“AddDional25”之类代码的方法对吗?有更好的方法吗?我计划从snap中显示的数组中提取“代码”。试试看 var codes = $('.coupon_code_text', req.responseText).map(function(){ return $(this).attr('code') }).get(); con
var codes = $('.coupon_code_text', req.responseText).map(function(){
return $(this).attr('code')
}).get();
console.log(codes)//it is an array containing all the code values
我觉得不错。但这并不是提出此类问题的合适场所。如果您有具体问题,我们很乐意提供帮助。