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 8468197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:51:52+00:00 2026-06-10T15:51:52+00:00

In my form, I want to do something with two fields: website_domain and website_ip_address

  • 0

In my form, I want to do something with two fields:

“website_domain” and “website_ip_address”

I’m trying to use jQuery/JSON to call a PHP script, pass the website_domain to it, and receive JSON including the IP address of that website.

Problem/Symptoms Description:

It’s partially working: On blur, it GETs the url of the PHP script. I can see that much in firebug. I get a 200 OK. Output from the PHP script is valid JSON according to JSONLint:

{“field”:”website_ip_address”,”value”:”74.125.225.70″}

But in Firebug, I don’t have a JSON tab. I only have Params and Headers tabs. Not even a Response tab.

Needless to say, the website_ip_address field is also not being populated with the data I should be getting from the PHP script’s JSON output.

My PHP Script:

It may be important to note that for now, this PHP script on a different domain from my application. Maybe my whole problem is cross-domain?

<?php 
    $domain = $_GET["domain_name"];
    $ip = gethostbyname($domain);
    // echo $ip;
    $json = array(
        'field' => 'website_ip_address',
        'value' => $ip,
        );
    header('Content-Type: text/plain');
    echo json_encode($json );
?>

My jQuery/JSON script:

Note this is written inside a Ruby On Rails application view.

:javascript
  $("#website_domain").bind("blur", function(e){
     $.getJSON("http://exampledomain.com/temp_getIP.php?domain_name=" +$("#website_domain").val(),
        function(data){
          $('#website_ip_address').val(data);
        });
});

I really hope this isn’t just a syntax error on my part. I’ve been writing/rewriting this for 2 days, based on answers I’ve found on StackOverflow, to no avail. I’m just missing something here.

  • 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-10T15:51:54+00:00Added an answer on June 10, 2026 at 3:51 pm

    You are currently attempting to output the JS object (that is formed from the parsed JSON response) to the field. You need to output a value from within it. So not:

    $('#website_ip_address').val(data); //data is an object, not a string
    

    but

    $('#website_ip_address').val(data.someValue); //output a property of the object
    

    With your code as it is, I would expect the field to be populated with the string representation of an object, which is [object Object]. You don’t mention this, so I wonder whether a) your success function is even firing (check this – stick a console.log in it); b) your jQ selector is sound.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery Validation plugin and trying to validate two time fields. I
I want to code a simple form layout in flex. Something like the following:
What I want to do is when a user clicks something: <div id=FormContainer> <form>
Is something like this possible: <form method=post action=myphp.php name=myname target=another_html/iframe_name>??? I want the php
i have a form and want to submit it with a script. i'm going
I have a form with two fields with the name attribute of 'photo_title' and
In my view, I want two buttons to populate three hidden fields of a
I have an asp page containing a form with two fields where the client
So i have this form.. With 2 fields. Youtube and link I want to
I have a form on which some text fields and two buttons are displayed.

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.