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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:40:55+00:00 2026-06-07T16:40:55+00:00

I am writing a page that grabs images from a url the user inputs,

  • 0

I am writing a page that grabs images from a url the user inputs, and using ajax, am updating a div with the img src to be displayed by fancybox in a modal window. The images that are displayed have titles displayed below, as links. This is done with fancybox (If you set the title as set the title="something" will display “something” below the image. If you set the title as title="<a href='something.html'>Something</a>)

My problem is this. I need to allow the user to choose an image by clicking the link, and in turn have it do 2 things: update the hidden field with the src url of the img, and submit the form.

Here is the code I have for the ajax request:

    function getCustomerInfo() {
        var phone = document.getElementById("urls").value;
        var url = "grabimages.php?urls=" + escape(phone);
        request.open("GET", url, true);
        request.onreadystatechange = updatePage;
        request.send(null);
        $("#dvloader").show();
        $("#selectimages").hide();
        //$("#noimages").hide();

        function updatePage() {
        if (request.readyState == 4)
            if (request.status == 200){
                if(request.responseText == ''){
                    $("#dvloader").hide();
                    $("#noimages").show();
                }else{
                    document.getElementById("update-div").innerHTML = request.responseText;
                    $("#dvloader").hide();
                    $("#selectimages").show();
                    $(".fancybox")
                        .attr('rel', 'gallery')
                        .fancybox({
                            padding : 15
                        });
                    $('input[id=theimage]').click(function(){

                        $(".fancybox").eq(0).trigger('click');
                    }); 


                    function recURL(recipeurl) {

                        $('#recipeurl').val('recipeurl');
                        document.recipeform.submit();


                    }

                }
            }else{
                alert('nothing');
            }

        }

And here is the code I tried for the href javascript call (this is the server side code, so PHP:

    echo "<a class=\"fancybox\" id=\"recipelinks\" title=\"<a href='#' onclick='javascript:recURL(" . $imagepath . ");'>Choose this Image</a>\" href=\"" . $imagepath . "\"><img src=\"" . $imagepath . "\" alt=\"\"/></a>";

This doesn’t do anything. Any suggestions?

  • 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-07T16:40:56+00:00Added an answer on June 7, 2026 at 4:40 pm

    Use $('.fancybody').live('click', function() { });, live allows you to listen for events on elements which are added to the DOM dynamically.

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

Sidebar

Related Questions

I'm writing a web page that has a from field that allows a user
I'm writing part of a web page that allows a user to build a
I'm writing a web page that will detect which college campus a user is
I'm writing a page that looks code wise like <div class=green> <span class=orange>s1</span> <span
I am writing a web page that selects certain fields from a database that
I`m writing a PHP page that parses given URL. What I can do is
I'm writing a php program that redirects user to a page.(something like link shortener)
I am writing a web page that uses some php files. The php isn't
I have a page that I am currently writing that is hosted on a
I've heard that writing out the entire ASP.NET page in one go helps performance.

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.