I am writing a store system for my game, it works quite well until I came to know It only takes quantity amounts before inserted the item.
function pbuy (buyitem) {var amountc = "sum -" + buyitem, var amount = $ ("#" + volume + ""). Val (); $ Ajax ({Type: "Post", URL: "Store 2.php", Data: "buyitem =" + buyitem + "and Zodiac =" + Zodiac, Success: Action {document.getElementById ('ajaxDiv') WinnerHTML = resp;}, Error: Function (E) {Warning ('Error:' + E);}}); }
I want to give it the ID of the form:
function pbuy (buyitem) {var amountc = "sum-" + Buyitem, var amount = $ ("#" + Quantity + "") Val ();
But nothing happens.
Forms of code are created:
NewPrice ;; & Gt; & Lt; Form method = "post" & gt; & Lt; Input type = 'text' id = 'sum- & lt ;? PHP $ line line ;; & Gt;) / ' & Lt; Input name = "itembid" type = "button" onclick = "pbuy (& lt ;? php $ line row;; & gt;)" price = "buy" /> & Lt; / Form & gt; & Lt; / TD & gt; & Lt; / TR & gt;
If I crumble the amount in the Ajax function then it all goes as well.
Before sending ajax-request, you are receiving a JavaScript error because you have your amountc Defining
and zodiac
characters by commas. Either do
var amountc = "zodiac -" + buyitem; Var amount = $ ("#" + volume + ""). Val ();
Semicolon is separated, or a comma, and the other var
var amountc = "zodiac -" + buyitem Skip, amount = $ ("#" + volume + "") Val ();
Comments
Post a Comment