Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Send my variable information to a url

    I am using the following code to prepend information into my list and it is working fine. On top of that, I want to send the 2 variable below (listDescription and payment) to a url as well as follows :

    htttp://mywebsite.com/public/user/spent/?amount=listDescription&account=payment

    Can I please know how i could do that? I tried using the ajax snippet below but it is not working. Thanks.

    Code:
    $(document).ready( function() {     
    
            $('#add_list').click( function() {
                var listDescription = $('#list_description').val();
                var payment = $('#payment').val();
    
    
                $('.expense_list').prepend('<div>' + "\u00A3 "  + listDescription + "\t\t\t" + payment + "\t" + '</div>'); 
    
    $.ajax({
            type:"Post",
            url:"htttp://mywebsite.com/public/user/spent/?amount="+listDescription+"&account="+payment,
           async:true,
           cache:false,
           success:function(data) {
    
    
            });
    
    
                $('#list_form')[0].reset();
                return false;                           
            });     
        });

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,444
    Thanks
    11
    Thanked 598 Times in 578 Posts
    an img can ping any server:
    Code:
    new Image().src="http://mywebsite.com/public/user/spent/?amount="+listDescription+"&account="+payment
    you also say htttp instead of http, so that might be your problem.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    And does the script and the ajax url belong to the same domain?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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