• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

The post function of my javascript code does not work as expected

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.

I have a question about javascript.

I have to use the post function in the javascript codes located in the html file header to send data in the queryString variable to the autocom.jsp file located in the local server and then get data back from my local database using the callback function, function(data) { }.

My problem is that when I input c in the input field of the html page, testing ok is displayed on the webpage, even when in my database I do not have a data in the last name column (called last in the database) which start by letter c. This should never have occurred since data.length >0 is not true in this particular case.

Could somebody please help me with this issue?

Thanks

The html file is search.html below:




Below is the autocom.jsp file:



 
Sheriff
Posts: 28326
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shay Given wrote:This should never have occurred since data.length >0 is not true in this particular case.



Could you show us the version of your code with the debugging statements demonstrating that data.length is equal to zero inside that if-statement? Or alternatively, could you explain how you determined that data.length was equal to zero?
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic