[英]what regex or functionality require to get the data from json response
$.ajax({
url: link, //https://www.linkedin.com/company/666511/
type: 'GET',
success: function (data) {
console.log(data)
//response comes in 2000 lines
here is the sample short response
["Web Development","Professional Training","Apprenticeship","Nonprofit"]
,
"companyPageUrl":"http://www.thedifferenceengine.io"
//i only want this link to return
http://www.thedifferenceengine.io
}
});
我不了解正则表达式或jquery的要求是什么,或者我如何删除此&quote并获取companypageurl
你可以使用正则表达式
/http:[^;]+/
let str = '["Web Development","Professional Training","Apprenticeship","Nonprofit"],"companyPageUrl":"http://www.thedifferenceengine.io"' console.log(str.match(/http:[^;]+/));
var decode ='["Web Development","Professional Training","Apprenticeship","Nonprofit"],"companyPageUrl":"http://www.thedifferenceengine.io"';
alert($("<div/>").html(decode).text());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.