I\’m using Coldfusion8.
I\’m receiving an Ajax request with an item number (random 35 charchater string), which I need to write/retrieve to the database.
Problem is, when I\’m passing only digits like:
23456
Coldfusion outputs receiving:
23456.0
If the string contains any letters like A12345 it works correctly.
Some code (although this does not show what\’s not working:
Javascript:
var btn = $(this).find(\'input\'),
putOnRack = btn.jqmData(\'index\'),
form = \"\",
service = \"../services/handler.cfc\",
method = \"process\",
returnformat = \"JSON\",
targetUrl = \"\",
formdata = \"form_submitted=store_selection&artikelnummer=\"+putOnRack+\"&method=\"+method+\"&returnformat=\"+returnformat;
// pass to AJAX
ajaxFormSubmit( form, service, formdata, targetUrl, successHandler, \"no\", \"\", returnformat, \"\" );
var ajaxFormSubmit =
function ( form, service, formdata, targetUrl, successHandler, dataHandler, errorHandler, returnformat, type ){
$.ajax({
async: false,
type: type == \"\" ? \"get\" : type,
url: service,
data: formdata,
dataType: returnformat,
success: function( objResponse ){},
error: function (jqXHR, XMLHttpRequest, textStatus, errorThrown) {}
In Coldfusion I\’m passing this through process, which validates and builds the form server side, then I pass to my database handler which gets a
`LOCAL.form`
object containing all the passed info, so my item number will be in LOCAL.form.artikelnummer
If I output this:
cfdump output=\"e:\\dump.txt\" label=\"catch\" var=\"#LOCAL.form.artikelnummer#\">
digit only strings are treated to .0
Question
How can I make sure I end up with varchar and not numbers, when passing a parameter via AJAX to Coldfusion?





Rating:
The post ajax – How to prevent Coldfusion adding decimals to digit-only varchars? appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/ajax-how-to-prevent-coldfusion-adding-decimals-to-digit-only-varchars.html
No comments:
Post a Comment