Making a Ajax request and manipulate the text

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Making a Ajax request and manipulate the text

Post 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
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Making a Ajax request and manipulate the text

Post by Christopher »

Have you checked your Javascript console for errors. I suspect your are getting cross-site scripting error.
(#10850)
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Re: Making a Ajax request and manipulate the text

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Making a Ajax request and manipulate the text

Post 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.
(#10850)
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Re: Making a Ajax request and manipulate the text

Post 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
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Making a Ajax request and manipulate the text

Post by Christopher »

You can do it from a server with PHP, Python, etc. But you can't do it from the browser with Javascript.
(#10850)
Post Reply