1

I have form with few text inputs and buttons, they are all same and looks like this:

<div class="form-group">
    <label for="inputUrl1">Url:</label>
    <input name="Url" type="url" class="form-control" id="inputUrl1" placeholder="Input your url here">
    <button type="submit" class="btn btn-success" onclick="getInformation()">Get information</button>
</div>

and I want to get data from url input and send ajax request to this url to get information about it(title and response code) I'm using ajax request:

<script>
    $(document).ready(function() {
        function getInformation() {
            var url = $("input").val();
            $.ajax({
                type: "GET",
                url: url,
                cache: false,
                success: function(data) {
                    $(".result").append(data);
                }
            });
        }
    })
</script>

but it doesn't work. How can I do that? To get some value from my input field, get information about this request and add it to my page.

Talha Awan
  • 4,573
  • 4
  • 25
  • 40
Rosti
  • 161
  • 1
  • 15
  • If the URL is not to the same origin, [you can't !](https://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy) – adeneo Jul 15 '17 at 07:12

0 Answers0