SRL Archive - Other Language Help and Tutorials

[HTML]Javascript][JQuiry?]Is it possible?


JPHamlett

2015-01-17 23:51:02

Is it possible to access information from site A from a script on site B on the same computer.

Example: I need to retrieve the name of someone in Site A,

It appears to be stored in this code


<span style="width: 1px"><input id="incident.caller_id" class="direction:ltr" type="hidden" onchange="onChange('incident.caller_id')" name="incident.caller_id" value="cac2822e4cc8a500fbf04c45b7ae6e38"><input id="sys_display.original.incident.caller_id" type="hidden" name="sys_display.original.incident.caller_id" value="THIS IS WHERE THE NAME IS">

Can I retrieve that info from site B somehow?

akarigar

2015-01-18 07:01:31

Since it sounds like you own both the sites, you can use CORS to make cross domain requests. Here is a pretty decent tutorial that will help you set it up. Feel free to send me a PM if you have any more questions.

J J

2015-01-18 08:26:43

Retrieve the page with jQuery and parse the HTML to get the value?
$.get
$.ajax

JPHamlett

2015-01-18 19:08:00

From: J J
Retrieve the page with jQuery and parse the HTML to get the value?
$.get
$.ajax


The issue is that the URL does not change. The name seems to be stored in a javascript applet(not sure about the terminology). Can I grab the fields of javascript?

I can pull the code up when I right click and select inspect element on Chrome.

Fairly similar to old school reflection.

J J

2015-01-27 00:41:37

From: JPHamlett
The issue is that the URL does not change. The name seems to be stored in a javascript applet(not sure about the terminology). Can I grab the fields of javascript?

I can pull the code up when I right click and select inspect element on Chrome.

Fairly similar to old school reflection.

If Chrome can show it then you can grab the value.
With the help of http://api.jquery.com/jquery.parsehtml/ or a different library it is certainly possible to grab the fields.

grats

2015-01-29 21:06:03

as said, CORS
assuming you own both sites. cross domain security complaints / issues have been around for a long time
other than that you'd need some naughty hacks to have the client get the page in the background & parse through it is probably the easiest part.. or use php/something else to


assuming it is your site access_control_allow_origin header should be '*' for all or 'whatever site name is' for CORS

parsing shouldn't be your biggest issue.. and you shouldn't be using all of jquery to do so

<span style="width: 1px">
<input id="incident.caller_id" class="direction:ltr" type="hidden" onchange="onChange('incident.caller_id')" name="incident.caller_id" value="cac2822e4cc8a500fbf04c45b7ae6e38">
<input id="sys_display.original.incident.caller_id" type="hidden" name="sys_display.original.incident.caller_id" value="THIS IS WHERE THE NAME IS">

<script>

var wut = document.getElementById('sys_display.original.incident.caller_id').value;
console.log(wut);
</script>