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

  • Home
  • SEARCH
  • 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 6389181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:22:18+00:00 2026-05-25T03:22:18+00:00

I am using a javascript function to generate a random string: function S4() {

  • 0

I am using a javascript function to generate a random string:

function S4() {
   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function guid() {

    /*$.ajax({
        type: "GET",
        url: "uuid.php",
        cache: false,
        success: function(html){
            return html;
        }
    });*/

   return (S4()+S4()+S4()+S4());
}

And I want to make it utilize a php uuid library that I’ve found, the problem is I need it to run in javascript. I use the guid() function a lot and I’ve been trying to think of an elegant way of grabbing the uuid, that I request using the ajax object (commented out above). The uuid page that just prints random uuids each time is sitting locally next to this page. I would not like to make the request synchronous because, like I said, I use it quite a bit and would prefer to not have everything halt every time this thing makes a request. Or perhaps there’s a method I could use of jQuery that be as fast and not hinder performance?

I’m not adverse to changing things up a bit, like would the best practice here to acquire a uuid on load? But the number of UUIDs I generate is completely dynamic, and dependent upon the user.

Thank you!

  • 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-05-25T03:22:19+00:00Added an answer on May 25, 2026 at 3:22 am

    How about adding a callback argument to the guid() function, wherein you can assign a value to something:

    function guid(callback) {
        $.ajax({
            type: "GET",
            url: "uuid.php",
            cache: false,
            success: function(html){
                callback(html);
            }
        });
    }
    
    var value;
    
    guid(function (result) {
        value = result;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following JavaScript code: <script language=JavaScript1.2 type=text/javascript> function CreateBookmarkLink(title, url) { if
I've been using John Resig's getStyle function from Pro JavaScript Techniques to get the
I am using JavaScript, jQuery and PHP. How do I limit the JavaScript function
How do you trigger a javascript function using actionscript in flash? The goal is
I'm using the following code to override a JavaScript function named dismissRelatedLookupPopup(). In Firefox,
I am using jQuery. I call a JavaScript function with next html: <li><span><a href=javascript:uncheckEl('tagVO-$id')>$tagname</a></span></li>
Without using a WebBrowser control, how could I execute a JavaScript function, that is
Is there a way to reload an entire frameset using Javascript onload() event? function
Is it possible to launch a new window in JavaScript using the window.Open function,
I am using jQuery and JavaScript, I need to call the jQuery function inside

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.