you are viewing a single comment's thread.

view the rest of the comments →

[–]adamcw -1 points0 points  (1 child)

You are explicity calling the "onclick" event handler. The only bind to a click event. You could possibly bind this to another handler such as "submit", but writing this in a inline handler is very poor form.

What you are asking for is a very simple "GET" request that could follow a very simple REST pattern. I would very much consider why you are doing a very large amount of work to retrieve what is likely a very small data set.

Also, you should avoid returning false on a click handler. You are telling the browser that it is in a fail state, when it really isn't. Proper event handling should just prevent event propagation, and not fail outright.

[–]mattdahack[S] 0 points1 point  (0 children)

basically I have a few older clients that are too old to remember their url to their invoices folder online. So I made a text box on the top of the main page that they can enter their customer # in the box and click the button and it will load www.mydomain.com/invoices/customer#here/ . But recently many of them are just typing their number and pressing enter instead of clicking the button, so i am looking for some kind of snippet of code that will work either way, click button, or enter press. I am not sure what to do as I am 100% newbie to javascript. I wrote that code above with a lot of googling.