Results 1 to 6 of 6

Thread: how do I send multiple POST 's with this? (ajax)

  1. #1
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default how do I send multiple POST 's with this? (ajax)

    Code:
    $(function()
    
    {
    
    $('.more').live("click",function()
    
    {
    
    var ID = $(this).attr("id");
    
    if(ID)
    
    {
    
    $("#more"+ID).html('<img src="moreajax.gif" />');
    
    
    
    $.ajax({
    
    type: "POST",
    
    url: "scripts/file.php",
    
    data: "lastmsg="+ ID,
    
    cache: false,
    
    success: function(html){
    
    $("span#updates").append(html);
    
    $("#more"+ID).remove(); // removing old more button
    
    }
    
    });
    
    }
    
    else
    
    {
    
    $(".morebox").html('The End');// no results
    
    }
    
    
    
    return false;
    
    });
    
    });
    http://stackoverflow.com/questions/6...-multiple-data

    I tried everything on that page, nothing works

    it sends that lastmsg post fine, that's all I can get it to send though.. I need to send one more..

    or a GET, either is fine with me, if someone knows how to do either



    nvm I gave up, just sent all data in that one POST and then separated it out with php, rofl.
    Last edited by grats; 02-27-2013 at 05:28 AM.
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

  2. #2
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    What do you mean when you say you want to send one more?


  3. #3
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    $(function()
    
    {
    
    $('.more').live("click",function() {
    
    var ID = $(this).attr("id");
    
    if(ID)
    
    {
    
    $("#more"+ID).html('<img src="moreajax.gif" />');
    
    
    
    $.ajax({
    
    type: "POST",
    
    url: "scripts/file.php",
    
    data: { lastmsg: ID, whatever: someValue },
    
    cache: false,
    
    success: function(html){
    
    $("span#updates").append(html);
    
    $("#more"+ID).remove(); // removing old more button
    
    }
    
    });
    
    }
    
    else
    
    {
    
    $(".morebox").html('The End');// no results
    
    }
    
    
    
    return false;
    
    });
    
    });
    That syntax should work, what are you trying to get work?

  4. #4
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default

    tried those, not sure why it doesn't work.. I gave up

    it needs the +ID because it grabs the ID I think (I am only good at php and database stuff -.- )


    anyway I just do

    $result = str_getcsv($postid, "p", "'");

    $tid = $result[1];

    $postidquery = $result[0];


    and my POST I send is somenumberpsomenumber

    like 123p123

    works well, I also sanitize everything except 0-9 and 'p' lol

    thanks for help though, not sure what is wrong with all of what everyone says it should be working.. but anything javascript just looks horrid to me so I avoid it as much as possible
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

  5. #5
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I was more saying the javascript you were trying to get to work. I started in php and javascript was different to get the hang of, especially if you write procedural PHP. It just took a bit of perseverance. Honestly though that is a pretty dumb way to get around it. If you could post the HTML and the javascript you want to work, I may be able to figure out what is wrong.

  6. #6
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default

    That's all it's doing though

    <div id="more201303011949081" class="morebox"><a href="#" class="more" id="201303011949081">Load Threads</a></div>

    I'd have to take two values out of two ID's instead of just one string that I identify (this one has two variables I take out in it, no need for str_getcsv though)

    tbh it's faster the way I'm doing it now, than grabbing two vars and printing out two separate of everything, everytime.. although it may be cool to figure it out


    http://www.9lessons.info/2009/12/twi...ults-with.html

    I got some of it here, a link I got from my other thread I had a question in.. (well a link I found from the other link)

    take note my div is a div, not a span, which is what that ajax calls for.. (because the link I PM'd you has two different places to do this, one uses one, other uses other)
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

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
  •