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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:09:38+00:00 2026-05-15T02:09:38+00:00

I am writing a function that well keep the user in lightbox images while

  • 0

I am writing a function that well keep the user in lightbox images while he adds to cart.

When you click any image it well enlarge using lightbox v2, so when the user clicks the Add image, it will refresh the page. When I asked about it at jcart support they told me to use jquery live, but I dont know how to do that. T tried this code but still nothing is happening:

        jQuery(function($) {

$('#button') 
    .livequery(eventType, function(event) { 
        alert('clicked'); // to check if it works or not
        return false; 
    }); 
 });

I also used

jQuery(function($) {

$('input=[name=addto') 
    .livequery(eventType, function(event) { 
        alert('clicked'); // to check if it works or not
        return false; 
    }); 
 });

yet nothing worked.

for code to create those images http://pasite.org/code/572

I also tried:

function adding(form){
$( "form.jcart" ).livequery('submit', function() {var b=$(this).find('input[name=<?php echo $jcart['item_id']?>]').val();var c=$(this).find('input[name=<?php echo $jcart['item_price']?>]').val();var d=$(this).find('input[name=<?php echo $jcart['item_name']?>]').val();var e=$(this).find('input[name=<?php echo $jcart['item_qty']?>]').val();var f=$(this).find('input[name=<?php echo $jcart['item_add']?>]').val();$.post('<?php echo $jcart['path'];?>jcart-relay.php',{"<?php echo $jcart['item_id']?>":b,"<?php echo $jcart['item_price']?>":c,"<?php echo $jcart['item_name']?>":d,"<?php echo $jcart['item_qty']?>":e,"<?php echo $jcart['item_add']?>":f}                                        
});
 return false;                                          
}

and it seems to add to jcart but yet it still refreshes

  • 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-15T02:09:39+00:00Added an answer on May 15, 2026 at 2:09 am

    .live() is to assign handlers to future creating elements. On your site, however, you are re-loading the page so .live would have no bearing. (you are submitting a form)

    It sounds like you want to make an ajax request to add the item to the cart and update that display on the site? That would be in the submit of the form and if jcart is dynamically created then yes, live is the answer.

    $('.jcart').live('submit', function() {
        // aggregate form elements into object and send via ajax
        // update the cart on the page, since we haven't reloaded the page the light box is still displayed
    });
    

    Regarding comment:

    When you send an ajax request, jquery takes an object as an argument. Such as $.post('urlToPostTo.php', { title: 'title of whatever', id: 5 } );

    The server sees this the same as:

    <form id="myForm" action="uroToPostTo.php" method="POST" >
        <input type="text" name="title" value="title of whatever" />
        <input type="hidden" name="id" value="5" />
        <input type="submit" name="submit" value="submit" />
    </form>
    

    So if you were to aggregate the form inputs into an object, there’s a few ways (even some jquery plugins to help you out). The primitive way would be:

    var $form = $('#myForm'); // instead of finding myForm over and over, cache it as a variable to use
    var objToSend = {};
    objToSend.title = $form.find('input[name=title]').val();
    objTosend.id =    $form.find('input[name=id]').val();
    $.post( 'urlToPostTo.php', objToSend );
    

    A more Elegant solution is to have something loop through all form elements and put them into an object for you. Plugins like http://docs.jquery.com/Plugins:Forms make that a bit easier.

    The end result is the form elements are stuffed into an object to send to your script.

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

Sidebar

Ask A Question

Stats

  • Questions 419k
  • Answers 419k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You probably need to put your Extensions namespace in web.config:… May 15, 2026 at 10:15 am
  • Editorial Team
    Editorial Team added an answer You should be able to do this in the controller:… May 15, 2026 at 10:15 am
  • Editorial Team
    Editorial Team added an answer As another suggestion, I have found the AMD CodeAnalyst a… May 15, 2026 at 10:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.