I'm trying to setup an html form to perform an AJAX update when a user exits a field. I've only tried to set this up on one table cell at the moment as follows:
我正在尝试设置一个html表单,以便在用户退出字段时执行AJAX更新。我目前只尝试将其设置在一个表单元格上,如下所示:
However I'm getting an error as follows:
但是我得到的错误如下:
SyntaxError: At least one digit must occur after a decimal point
SyntaxError:小数点后必须出现至少一个数字
If I change the cell to something like this:
如果我把单元格改成这样:
it works. However I need to use the longer ID string as that is the record ID required for the database update and I cannot change the format of this string.
它的工作原理。但是,我需要使用较长的ID字符串,因为这是数据库更新所需的记录ID,我不能更改此字符串的格式。
I'm new to Javascript and AJAX so not sure what could be the issue with the longer string? There's no decimal points that I can see either.
我是Javascript和AJAX新手,所以不确定长字符串会有什么问题?我也看不到小数点。
1 个解决方案
#1
3
Due to content of 1E1DDA14-D2C6-4FC8-BA5F-DBCCC7ABAF7F having letters and - characters, you need to wrap it in quotes to denote it as a string literal:
由于1E1DDA14-D2C6-4FC8-BA5F-DBCCC7ABAF7F的内容有字母和-字符,所以需要用引号将其括起来,表示为字符串文字:
οnchange="updateRecord('1E1DDA14-D2C6-4FC8-BA5F-DBCCC7ABAF7F')"
Unqouted and not numeric, JavaScript is expecting a variable or other object (null, false etc). Your 12345 test works because it only contains numbers.
不符合查询,而不是数字,JavaScript希望得到一个变量或其他对象(null, false等)。您的12345测试工作,因为它只包含数字。