Results 1 to 5 of 5

Thread: code not working in safari iphone and ipad

  1. #1
    Join Date
    Nov 2011
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default code not working in safari iphone and ipad

    Hi all

    I am opening a popup on click of a button and there is a "add to cart" button in the popup which is adding the product to the cart.

    Its working fine in all browsers except safari in iphone and ipad and mac desktop safari.

    On safari the popup closes on click of "add to cart" button and product doesnt gets added to cart.

    Code:
    <form name="myform" id="myform" method="post">
    <input type="hidden" value="<?php echo $id ?>" name="id" />
    <input type="submit" value="ADD TO CART" name="qbutton" id="qbutton" />
    </form>
    javascript
    Code:
    <script type="text/javascript">
        $(document).ready(function() {
    	$("#result").hide();
            $("#qbutton").click(function() {
                    $("#result").show();
                    $("#result").html('Processing...');
                    $.ajax({
                        type: "POST",
                        url: "ajaxcart.php",
                        data: $("#myform").serialize(),
                        cache: false,
                        success: function(data) {
                            $("#result").html(data);
    						 }
                    });
               return false;
            });
        });
    </script>
    Thanks
    Vineet

  2. #2
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,618
    Thanks
    59
    Thanked 100 Times in 98 Posts
    Blog Entries
    4

    Default

    It may be an issue related to jQuery.
    The click event isn't triggered by some mobile devices in some browsers.
    Try this inplace of your current script (untested)

    Code:
    $(document).ready(function() {
    	$("#result").hide();
    	$("#qbutton").on("click touchstart", function() {
    		$("#result").show();
    		$("#result").html('Processing...');
    		$.ajax({
    			type: "POST",
    			url: "ajaxcart.php",
    			data: $("#myform").serialize(),
    			cache: false,
    			success: function(data) {
    				$("#result").html(data);
    			}
    		});
    		return false;
    	});
    });
    Posting Tips + FAQ | Issues? Feel free to PM me
    - keyboard1333[at]gmail[dot]com

  3. #3
    Join Date
    Nov 2011
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Keyboard

    No This is also not working on safari iphone, ipad.

    The popup closes on click of add to cart button.

    Vineet

  4. #4
    Join Date
    Nov 2011
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    Also can someone tell me how to update a "div" content that is on parent page on click of "add to cart" button.

    Thanks
    Vineet

  5. #5
    Join Date
    Feb 2006
    Posts
    236
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default

    The problem is with the ipad - it has a touch screen instead of a mouse, so a click never occurs, and the default behavior permits menu control by hover. Therefore, you have to make the element clickable. Add onclick="" to the element so the element knows its clickable; alternatively, you can define it so in css for that element as cursor: pointer;

Similar Threads

  1. Drill Down Menu not working in Safari iPhone
    By jakereed in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 08-02-2013, 07:37 PM
  2. Ultimate Fade In Slideshow--Freezes on ipad and iphone
    By dcarlson in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 01-26-2013, 07:27 PM
  3. Replies: 3
    Last Post: 07-22-2012, 10:25 PM
  4. AnyLink JS Drop Down - link not working on iDevices (iPhone/iPad)
    By neoboy14 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 10-12-2011, 02:32 PM
  5. Replies: 0
    Last Post: 06-21-2011, 06:45 AM

Bookmarks

Posting Permissions

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