我正在使用Framework7的移動應用程序& Cordova。我希望能夠將JSON數據的內容分享到共享功能中。我正在使用Cordova插件SocialSharing-PhoneGap-Plugin。將Json數據解析爲函數
這裏是鏈接到我的JSON數據http://www.crewits.net/streaminfo.json
這裏是分享功能,你只想要一個解析有效的JSON在JavaScript
function shareNowPlaying() {
var options = {
message: 'MESSAGE FROM JSON DATA',
subject: 'SUBJECT FROM JSON DATA',
files: ['IMAGE FROM JSON DATA'],
url: 'URL FROM JSON DATA',
chooserTitle: 'Pick an app'
}
var onSuccess = function(result) {
console.log("Share completed? " + result.completed);
console.log("Shared to app: " + result.app); (result.completed=false)
}
var onError = function(msg) {
console.log("Sharing failed with message: " + msg);
}
window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
}
它目前尚不清楚你想要做什麼。在onSuccess中,您可以訪問結果。只要做'console.log(result);'看看有什麼可用的。 – theduke