mcmuney Posted March 27, 2012 Share Posted March 27, 2012 There's this line of code within a .js file: o.tweet_raw_text = o.retweet ? ('RT @'+o.retweeted_screen_name+' '+item.retweeted_status.text) : item.text+o.bird; This line is referenced inside a javascript as "{tweet_raw_text}" that displays a tweet. What I'd to do is use this php function inside the javascript: $str = preg_replace('/http:\/\/.*?$/i', '', $str); Any help would be greatly appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/259786-string-replace-in-javascript/ Share on other sites More sharing options...
trq Posted March 27, 2012 Share Posted March 27, 2012 JavaScript string object has it's own replace() method. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace Link to comment https://forums.phpfreaks.com/topic/259786-string-replace-in-javascript/#findComment-1331498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.