Sinisterly
Help with JavaScript and JSON - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: Help with JavaScript and JSON (/Thread-Help-with-JavaScript-and-JSON)



Help with JavaScript and JSON - hacxx - 11-17-2019

I have a script that uses a api to query a results page. The results are in JSON and i want to ask for a object in JSON, get the data, change the value and use in a http request.

The problem is that i don't know how to change the object value. Here is a snip but it's giving error...
Code:
for (x in myObj.items) { var str = ""+ myObj.items[x].link +""; var res = str.replace(""+ myObj.items[x].displayLink +"", ""); var res = str.replace("http://", ""); var res = str.replace("https://", ""); var res = str.replace("/wws/info/", ""); document.write(''+res+'\n'); }

The myObj.items[x].link is something like
http://website.com/wws/info/test123

And i want as a string test123. Both domain and path are random and can be removed.

Thanks


RE: Help with JavaScript and JSON - hacxx - 11-17-2019

Note: I already found a solution....