Forum Discussion
ArchiveUser
11 years agoQrew Captain
I'm new to AJAX and am having trouble getting this example to work.
What I'm trying to do is base the next number on a numeric item number field (because they don't line up directly with Record ID since we imported much of our data from an existing database).
The field ID containing my item number is 191 so I've made the following changes:
var dbid = "I put our dbid here";
var apptoken = "I put our app token here";
$.ajaxSetup({data: {apptoken: apptoken}});
var promise = $.get(dbid,{
act: "API_DoQuery",
clist: "191",
slist: "191",
options: "num-1.sortorder-D"
});
$.when(promise).then(function(xml)
{
var next_item = $("#_fid_191",xml).text() + 1;
$("#_fid_310").val("TMJPM-" + next_item);
});
All I ever get returned from "next_item", though, is 1
Any help would be greatly appreciated.
Thanks
What I'm trying to do is base the next number on a numeric item number field (because they don't line up directly with Record ID since we imported much of our data from an existing database).
The field ID containing my item number is 191 so I've made the following changes:
var dbid = "I put our dbid here";
var apptoken = "I put our app token here";
$.ajaxSetup({data: {apptoken: apptoken}});
var promise = $.get(dbid,{
act: "API_DoQuery",
clist: "191",
slist: "191",
options: "num-1.sortorder-D"
});
$.when(promise).then(function(xml)
{
var next_item = $("#_fid_191",xml).text() + 1;
$("#_fid_310").val("TMJPM-" + next_item);
});
All I ever get returned from "next_item", though, is 1
Any help would be greatly appreciated.
Thanks