Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Correct way of passing Query String to Update service

I am trying to run an update service from javascript. WHats the correct syntax to pass the _id to the Query String part of request? I have tried this and I get bad request error

var jno=$(this).closest("li").find("[name=lblJobID]").text();
var type=$(this).closest("li").find("[name=txtJobType]").val();
var desc=$(this).closest("li").find("[name=txtJobDescription]").val();
var hours=$(this).closest("li").find("[name=txtJobHours]").val();
var date=$(this).closest("li").find("[name=txtJobDate]").val();

updateJobs.execute({"data":{"_id":jno, "type":type, "description":desc, "jobDate":desc, "hours":hours}});

Image

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Correct way of passing Query String to Update service

Hello Aeneas,
1) input for _id value
{TradeTrack_Jobs_Id}
2) in the Settings you are using for this REST service add new variable TradeTrack_Jobs_Id
3) before updateJobs place next line
Settings.TradeTrack_Jobs_Id = ID_TO_UPDATE;

Note: that Settings should be replaced with real name of REST Settings.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Correct way of passing Query String to Update service

Sorry that doesn't answer my question as I want to update dynamically not from the settings file.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Correct way of passing Query String to Update service

Sorry that doesn't answer my question as I want to update dynamically not from the settings file.

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Correct way of passing Query String to Update service

Aenas,
you can dynamically change value of variable in Settings with next line:
Settings.TradeTrack_Jobs_Id = ID_TO_UPDATE;

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Correct way of passing Query String to Update service

Ok thanks but how do I include it in this type of call as I don't want to set up too many variables.

updateJobs.execute({"data":{"_id":jno, "type":type, "description":desc, "jobDate":desc, "hours":hours}});

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Correct way of passing Query String to Update service

Hi Aeneas,
you don't need to include it in actual call.
Consider it as a preparation before calling service. You need to set this Settings variable at least before service execute, and during execution service will look through all variables that defined as Settings variables and get value of each of them

Return to “Issues”