add a javascript variable to a get link

This javascript function uses a variable (newPrice)

I need to include it in the savedata.asp as a variable to be passed like &newPrice=(I dont know how to insert the js newPrice Variable) newPrice is already defined properly, it has a proper value

$("img#otro").on("click",function(){
 if(send && Validate("form[name=forma]")){
  send=false;
  $("form[name=forma]").ajaxSubmit({url: 'savedata.asp?origen=Otro&newid=<%=Request.Cookies("newid")%>&evento=<%=Request.Cookies("evento")%>&referer=<%=referer%>', type: 'post', success: function(){
   $( document ).ready(function() {
	DrawCaptcha();
	totalPrice += newPrice;
    document.forma.reset();
    send=true;
    alert(totalPrice);

Open in new window

robrodpAsked:
Who is Participating?
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
this should get you there:

$("form[name=forma]").ajaxSubmit({url: 'savedata.asp?origen=Otro&newid=<%=Request.Cookies("newid")%>&evento=<%=Request.Cookies("evento")%>&referer=<%=referer%>&newPrice='+newPrice, type: 'post', success: function(){
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Have you tried your code with static data?  There are some things that seem wrong here to start.

"form[name=forma]" should be 'form[name="forma"]' and the ready function goes on the outside.
0
 
robrodpAuthor Commented:
Great help worked fine
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.