.ajax({ type: 'POST', url: '..serverices/ajaxserver.asmx', data: 'lname='+ $('#lastname').val() }); return false;
if #lastname has one quote, it throws an error. How to deal with this?
Chetan is the right to jQuery for you. But it's worth mentioning the JavaScript escape() function, which is pretty simple:
escape()
>>> "O'Malley" "O'Malley" >>> escape("O'Malley") "O%27Malley"
Do not create a query string yourself when jQuery can do it for you
data: {"lname" : $('#lastname').val()}
You can use the pair format as follows:
$.ajax({ type: 'POST', url: '..serverices/ajaxserver.asmx', data: { "lname" : $('#lastname').val() } });
Source: https://habr.com/ru/post/1305239/More articles:Which Python module to use for Memcached? - pythonHow can I query all Winform children recursively? - c #Mathematica - import CSV columns and processes? - wolfram-mathematicaServer ping delay measurement - Python - pythonHow to name several versions of ServiceContracts in the same WCF service? - namespacesWhat is the most efficient way to run programs in Emacs after compiling Mx - emacsWhy does the jQuery slideDown function hide the scroll bar? - jqueryRecipe for adding Drupal node records - indexingLinq to SQL problem - c #In C #, how can I serialize a List to byte [] to save it in a DB field? - listAll Articles