Page 1 of 1

Making a Ajax request and manipulate the text

Posted: Thu Oct 18, 2018 10:43 am
by sjuaq
Hi,

I'm looking for a way to make a page request in Ajax and retrieve the request page to a string. This string should be available to any function but in the example below it isn't because alert(data); doesn't popup. After converting to a string i want to manipulate the text by using "find" to look for a string or a text in a determined area. Can this be done?

Code: Select all

<input type="text" id="http" value="http://www.example.com">
<br>
<input type="button" id="submit" onclick="myhttp()" value="Send!"/>
<script>
function myhttp() {
    var http = document.getElementById("http").value;
    var dataString = 'lsd=AVrls4dL&email=email@gmail.com';

            $.ajax({
            type: "GET",
            url: http,
            data: dataString,
            async: false,
            success: function(data){
            alert(data);
            }
            });
            
    }
</script>
Thanks

Re: Making a Ajax request and manipulate the text

Posted: Fri Oct 19, 2018 8:39 pm
by Christopher
Have you checked your Javascript console for errors. I suspect your are getting cross-site scripting error.

Re: Making a Ajax request and manipulate the text

Posted: Sat Oct 20, 2018 4:48 pm
by sjuaq
Yes, is giving CORS error, do you have any other language suggestion? I tried in JS and PHP but it doesn't work.

Also, while i was searching i found a Python Script that does half of the work that what i'm trying to build. Is Python more open in terms of development?

Re: Making a Ajax request and manipulate the text

Posted: Mon Oct 22, 2018 3:57 pm
by Christopher
You can call a PHP script on the same domain as the Javascript. That PHP script can fetch the contents of another domain, parse it, and return data to the Javascript script.

Re: Making a Ajax request and manipulate the text

Posted: Sun Nov 11, 2018 2:45 pm
by sjuaq
I can't add files to the server. The form i want to retrieve information is
https://www.facebook.com/login/identify?ctx=recover

Here is a Python script that works very similar to want i'm trying to achieve but i just want the info
https://github.com/PaulSec/osint-facebo ... t-password

Re: Making a Ajax request and manipulate the text

Posted: Mon Nov 12, 2018 10:01 pm
by Christopher
You can do it from a server with PHP, Python, etc. But you can't do it from the browser with Javascript.