www.webdeveloper.com
Results 1 to 4 of 4

Thread: Opening new tab but not going to it

  1. #1
    Join Date
    May 2012
    Posts
    60

    Opening new tab but not going to it

    Is there anyway i can make the paypal 'add to cart' button not go to the 'cart' page when clicked?

    Obviously still open it up in a tab, but i want it to stay on the current page so more stuff may be added...

    This is proving a lot harder than i thought...


    any advice?

  2. #2
    Join Date
    Jul 2011
    Posts
    131
    HTML Code:
    <a href="some_url" target="_newtab">Click here to open in new tab</a>

  3. #3
    Join Date
    Mar 2012
    Posts
    1,278
    Quote Originally Posted by kromol View Post
    HTML Code:
    <a href="some_url" target="_newtab">Click here to open in new tab</a>
    I've never heard of "_newtab". The nearest I'm aware of is "_blank", and that will not do what is requested here.

  4. #4
    Join Date
    Jul 2011
    Posts
    131
    Sorry, I didn't understand you right.
    You should use AJAX for adding product to the cart and stay on the current page. But you also should use javascript and php for this purpose.
    HTML Code:
    <a href="#" onclick="return ajaxAdd();">Add to cart</a>
    And javascript code will look like this (with using jQuery):
    Code:
    function ajaxAdd() {
      $.ajax({
         url: 'your url',
         type: 'post',
         date: {some data},
         success: function(){
             //some code here
         }
      });
      return false;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles