24/7 Support - 800.608.6482

Miva Merchant Community Forums

  1. #1
    Join Date
    Dec 2009
    Posts
    1,610

    Default Need help with AJAX POST

    Hello forum:
    Hope someone can help. I am using the following POST in my AJAX routine:
    xmlhttp.open("POST","http://xxx.com/mm5/UpdateCarrier.php",true);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlhttp.send("basket_id=307496&carrier=Roadrunner" );

    This works OK with constants for basket_id & carrier but I need to use javascript variables in the send instead of constants. How should the send be coded to use my JS variables?
    Thanks, Larry

  2. #2
    Join Date
    Dec 2009
    Posts
    1,610

    Default Re: Need help with AJAX POST

    Nevermind:
    I got this to work
    xmlhttp.open("GET","http://xxx.com/mm5/UpdateCarrier.php?basket_id=" + basket + "&carrier=" +carrier + "&t=" + Math.random(),true);
    xmlhttp.send();

    Larry
    Last edited by wajake41; 02-19-13 at 08:11 AM.

  3. #3
    Join Date
    Dec 2009
    Posts
    1,610

    Default Re: Need help with AJAX POST

    This POST works too:
    var msg = "email=" + email + "&zipcode=" + zipcode + "&t=" + Math.random();
    xmlhttp.open("POST","http://www.xxx.com/mm5/ShowCustomer.php",true);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
    xmlhttp.send(msg);

    Larry

Posting Rules

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