Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8610757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:12:13+00:00 2026-06-12T04:12:13+00:00

I am trying to figure out how o combine jQuery code, where I grab

  • 0

I am trying to figure out how o combine jQuery code, where I grab a URL value from a field a PHP code that will hit that URL to check if the site exists… I have to use the jQuery in this case. Perhaps i can validate the URL with it too?..

$("#go").click(function() {
    var $url = $("#url").val();
    <?php
    $x = @fopen($url,"r");
    if ($x) {
    ?>
        $("#ws").attr("src",url);
        $("#start").remove();
    <?php
        fclose($x);
    } else {
    ?>
        alert("bad URL");
    <?php
    }
    ?>      
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:12:15+00:00Added an answer on June 12, 2026 at 4:12 am

    You are mixing client- and server-side languages. PHP is run on the server, before the page is served to the client. JavaScript (thus jQuery) does usually run on the client. Due to this, it doesn’t make sense to mix the languages like in your example. You will have to separate them, using JavaScript on the client, making request to server. On the server you can then use PHP.

    Step-by-step what you need to do:

    1. Use jQuery on the client side to get the address.
    2. Use jQuery to make an AJAX-request to the server, sending the URL to validate as data with the request.
    3. On the server-side you check if the URL is valid through PHP, using cURL or some other method. Then you return the result as JSON for instance.
    4. On the client-side, read the response and act accordingly.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to figure out how to type (via events not set the value) on
I'm trying to figure out how many possible ways there are to combine various
I'm trying to figure out how to combine the following Expressions: Expression<Func<TParent, ICollection<TChild>>> childSelector
I'm trying to create a single query that will combine the following two queries.
I'm trying to figure out how to use StateT to combine two State state
I'm trying to make the following work but can't figure out how to combine
I'm trying to combine the codes from these two questions: using jQuery to slideToggle
I'm trying to figure out the simplest code to add leading zeros on to
I'm trying to figure out the best approach to display combined tables based on
Trying to figure out how I can do this properly. The print_r looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.