javascript - JS function/ajax only passing one parameter -


I have searched here many formulas and can not find the answer.

I have to have JS font to post 2 parameters on a php page via AGX. Function: acceptbet (companyid, userid) {$ .ajax ({type: "post", url: "acceptbet.php", data: "companyid =" + companyid + "& amp; Amp; userid = "+ userid, success: function (msg) {warning (company + user id);}}); }

I have also tried to do this like this: function acceptabate (company, user-end) {$ .ajax ({type: Post ", url:" Acceptbet.php ", data: {companyid: companyid, userid: userid}, success: function (msg) {alerts (company + user id);}}); }

Whatever I do, I can not find it to pass both the "UserId" and "Company" parameters - and the warning will only show the first one. I tried to change the two parameters, and still retire only for the first time.

I apologize if I am a deceitful mistake, but I do not understand how acceptbet.php

help is greatly appreciated.

Edit: Here is the code for acceptbet.php:

  $ userid = $ _ POST ['userid']; $ Companyid = $ _ post ['companyid']; $ Accepted = 1; $ Acceptbet = $ connection- & gt; Ready ("UPDATE user_bet set = acceptable? Where user_id =? And user_company_id =?"); $ Acceptbet- & gt; Bind_param ("iii", $ accepted, $ userid, $ companyid); $ Acceptbet- & gt; Executed ();    

My syntax was perfect. The comments given by those people were very useful for separating the problem, which was in my SQL update - was expecting a record to update, but it was not - that was because my block was wrong. For reference, the syntax below should always work to pass several parameters in "data" on Ajax:

  Function Acceptabate (Company, UserId) {$. Ajax ({type: "post", url: "acceptbet.php", data: {companyid: companyid, userid: userid}, success: function (msg) {alerts ("success")}}}); }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -