jquery - Javascript - sending command in a proper way while using get method -


i need send embedded device following command get method value continuouspantiltmove: string(pt) not sent cgi script via google chrome, result fails.

i cant fix in cgi script because not managed me embedded device.

how can submit iframe? or correctly via $.get if iframe not possible.

when open url in google chrome url cgi script works, not working $.get method.

enter image description here

function button_axisleft() {   if(alr>100) {     alr = 100;   }    if(alr<-100) {     alr = -100;   }     alr = alr - 1;     pt ="'" + alr + "," + aud + "'";     $.get('http://192.168.1.59/axis-cgi/com/ptz.cgi', {       camera: 1,       continuouspantiltmove: string(pt),       imagerotation: 0,   }, function(msg) {     console.log('ok');   }); } 

edit: working version

// pan-tilt-zoom // no need modify in cgi function button_axisleft() {   if(alr>100) {     alr = 100;   }     if(alr<-100) {     alr = -100;   }      alr = alr - 1;     pt =alr + "," + aud;        $.get('http://192.168.1.59/axis-cgi/com/ptz.cgi?continuouspantiltmove=' + pt, {       camera: 1,       imagerotation: 0,   }, function(msg) {     console.log('ok');   }); } 

since mentioned in comments you want this:

continuouspantiltmove=-100,-50&other=values 

then it:

function button_axisleft() {     if (alr > 100) {         alr = 100;     }      if (alr < -100) {         alr = -100;     }     alr = alr - 1;     pt = alr + "," + aud;      $.get('http://192.168.1.59/axis-cgi/com/ptz.cgi?continuouspantiltmove=' + pt, {         camera: 1,         imagerotation: 0,     }, function (msg) {         console.log('ok');     }); } 

you had single quotes (') around numbers in pt variable. and, according comment, don't want those, removed them. seems jquery automatically url-encodes characters, such comma, , that's why query string looking weird. including query parameter directly in url string, can skip jquery's auto-encoding.

however, should check out: can use commas in url?


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -