[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Appending a variable on a .post in jquery. Must be doing it wrong?

Hi,
I'm guessing I'm adding my account_id variable wrong in this post using jquery. I see the php is working fine (the variable appears). I'm just thinking I have a syntax error somewhere in the url:

 
$.post("application/modules/account/scripts/start_social.php",{ account_id:"<?php echo $account_id;?>", campaignstartmessage:$("#campaignstartmessage").val(),twitter:$('#twitter:checked').val(),facebook:$('#facebook:checked').val() } ,function(data)

Open in new window


Any idea where I'm incorrect?

This is what it looks like prior to posting it:

 
$.post("application/modules/account/scripts/start_social.php",{ account_id:"4", campaignstartmessage:$("#campaignstartmessage").val(),twitter:$('#twitter:checked').val(),facebook:$('#facebook:checked').val() } ,function(data)

Open in new window


See anything?

Thanks tj
0
tjyoung
Asked:
tjyoung
  • 2
  • 2
  • 2
2 Solutions
 
sonawanekiranCommented:
Just for debugging. Try with absolute url like

$.post("http://www.whateverdomain.com/application/modules/account/scripts/start_social.php",{ account_id:"<?=$account_id;?>", campaignstartmessage:$("#campaignstartmessage").val(),twitter:$('#twitter:checked').val(),facebook:$('#facebook:checked').val() } ,function(data)
0
 
tjyoungAuthor Commented:
Trying...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
sonawanekiranCommented:
Seems there is syntax error

$(document).ready(function(){
  $.post("application/modules/account/scripts/start_social.php",
  { account_id:"<?=$account_id;?>", campaignstartmessage:$("#campaignstartmessage").val(),twitter:$('#twitter:checked').val(),facebook:$('#facebook:checked').val() } ,
  function(data)
  {
   
  }
});
0
 
tjyoungAuthor Commented:
It was a typo on the receiving script. There goes 2 hours of my life I'll never get back. Thank you very much for your responses though. They are good references regardless.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now