SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    How do you guy grab a value from this javascript

    Hi,
    I'm wondering if anyone know how to grab values of the results from this javascript snippet. I want to store the value into database.

    Code:
    <script language="Javascript" src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity">
    </script>
    <script language="Javascript">
    	document.write("<p>Welcome to visitors from "+sGeobytesCity+", "+sGeobytesCountry);
    </script>
    Thanks,

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    If you want to get values from JavaScript in to a database you could make an AJAX request to a server side script that subsequently stores the data in a database.

    You wouldn't be able to do this with JavaScript alone though, you will also need a server side language (like .NET, PHP, Ruby, etc.) to connect to a DB and store the data.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thanks for quick response,

    Can you please more specific. I use PHP and MySql. I want to grab the displayed results and store into a table.

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Essentially there are 2 ways you can do this, an easier way would be to create an iframe that's hidden in the DOM that sends through the values or as John said use Ajax, if your not strong with JavaScript the iframe technique is a good way to go but Ajax would be cleaner and more efficient as it can be re-used where as an iframe needs to be manipulated every single time you make a request.

  5. #5
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I get a picture. Look like there's a thorny road ahead though.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •