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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:34:23+00:00 2026-05-19T23:34:23+00:00

For coping to the clipboard I’m using Zero Clipboard , recommended by this answer

  • 0

For coping to the clipboard I’m using Zero Clipboard, recommended by this answer.

The code works perfectly fine when used in this form.

<div id="d_clip_button" style="background: #FFFFCC;">
    Click to copy
</div>
<script language="JavaScript" type="text/javascript">
        var clip = new ZeroClipboard.Client();
                        clip.setText( '<?php echo "http://example.com/" . $var; ?>' );
                        clip.glue( 'd_clip_button' );
</script>

A problem occurs when this above code is called dynamically like this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>

<form action="generar.php" method="post">
Input: <input type="text" id="longUrl" name="longUrl" value="" /><br />
<input type="button" value="Acortar!" onclick="submitme()" />
<div id="resultado"></div>
</form>



<script type="text/javascript" charset="utf-8">

    function submitme(){
    var tosend=document.getElementById("longUrl").value;
    $.ajax({
            type: 'POST',
            url: 'generar.php',
            data: 'longUrl='+tosend,
            success: function(msg){
                if(msg){
                    document.getElementById("resultado").innerHTML=msg;
                }
                else{
                    return;
                }
            }
        });
    }

</script>

The “Click to copy” appears but the resource is not called correctly since it’s “not flash”.

Any ideas on how to make this work / what is the problem?

Thanks in advance!! Please ask for any clarification needed!


Could it have (don’t think so) anything to do with the whole thing being nested on a div?

  • 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-19T23:34:23+00:00Added an answer on May 19, 2026 at 11:34 pm

    innerHTML doesn’t execute JavaScript that gets passed through in the Ajax call.

    Use jQuery’s .html().

     $("#resultado").html(msg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Coming from a Classic ASP background, I'm used to multiple forms on a page,
Coming from a java background, one of the things I am used to is
I need to copy a string and a bitmap to the clipboard. I have
Using VBA inside Access2003/2007. How to copy the contents of a string variable to
I have written some code based on a specification from my boss. A requirement
On one of my sites, I used &shy; liberally to provide better hyphenation in
When using the SQL Server (2005, 2008) Save Results As... option, I do get
Coming from a corporate IT environment, the standard was always creating a class library
coming back to postgresql after several years of oracle ... what are the state-of-the
Coming from a background, I'm familiar with GUI editors that do a poor job

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.