/    Sign up×
Community /Pin to ProfileBookmark

Escaping mulitple variables problem

Hi there, i’m trying to do a bit of a clean up job on some code, but can’t get the last bit working, basically i’ve got a list of equipment that’s pulled through from a database with the value of each being the id of each piece of equipment, users should be able to make multiple equipment selections to query the database. This is the code.

[CODE] var equips=””;
for(i=0;i<jQuery(“#erows”).val();i++) {
if(jQuery(“#equipment_”+i+”:checked”).val())
equips+=jQuery(“#equipment_”+i+”:checked”).val()+”;”;
}

var gdata=”erows=” + escape( equips );[/CODE]

It currently query’s the database successfully if a single piece of equipment is selected, however if multiple bits of equipment are selected by the user they get an error. It appears to be when escaping multiple variable selections are pulled through in the gdata var. Can anyone help where I may be going wrong with this?

Many thanks.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @vectrex spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...