Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!

Bear Bibeault

Sheriff
+ Follow
since Jan 10, 2002
Bear likes ...
IntelliJ IDE Java jQuery Mac Mac OS X
Author of:
Secrets of the JavaScript Ninja, 1st and 2nd editions,
jQuery in Action, 1st, 2nd and 3rd editions,
Ajax in Practice, and
Prototype and Scriptaculous in Action
Austin, TX
Cows and Likes
Cows
Total received
170
In last 30 days
0
Total given
185
Likes
Total received
4478
Received in last 30 days
0
Total given
2882
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt Green check
expand Greenhorn Scavenger Hunt Green check

Recent posts by Bear Bibeault

No one here is going to do your work for you.
1 month ago
That likely means your URL is malformed. What happens when you try to load that URL directly into the browser?

Also, why is your URL absolute, versus server-relative? You could run into CORS issues.

Bear Bibeault wrote:Does the Networking Panel show that a request is generated?

Does the Networking Panel show that a request is generated?
So now, the page will not submit as you have blocked that. How does the behavior change? Use the network tab in DevTools to see if any request is being generated. Any errors in the console log?
One problem I see (besides the code formatting which is all over the place) is that you are not stopping the default action of the form submission. If you want to make an Ajax call rather than actually submitting the form, you either need to call the preventDefault method of the event, or return false from the event handler.

Why aren't you using jQuery to do all this? Makes it tons easier.
As pointed out already, that is JavaScript, not Java. Despite the unfortunate naming, they have nothing to do with each other.

The very first thing you should do is to look up how to use the browser Dev Tools. That way, you can set breakpoints and debug your code right in the browser.

That will make it much easier for you to tell us where the code is going wrong, or perhaps even see the problem(s) yourself.
Because you catch the exception in the method, it cannot propagate to the caller. I would change the method to let the exception propagate to the caller where the caller can catch it (if it wants to) and deal with the problem.
2 months ago

zhanara Kushueva wrote:
it's my friend's HW, sorry have nothing to show...


Send your friend here to show his or her work. We aren't going to do the homework for him or her, but can give the help needed to do it themselves.
2 months ago
JSON.stringify() is not a jQuery API, so if there were an error in generating the JSON (unlikely), the problem would not be with jQuery.

If this were my problem I'd be using the browser tools to see the request that is being sent to make sure that it contains what is expected. If it does not, then the problem would be somewhere on the front end while generating the request. If the request is as expected, the problem is likely on the back-end, perhaps with the REST mappings.

Andrey Dmitriev wrote:   In console:  The origin server did not find a current representation for the target resource or is not willing to disclose that one exists
for:   /jsfiles/jquery-1.4.2.min.js


That does not match your code, where you use:
to load jQuery 2.2.4.

Are you also trying to load jQuery somewhere else?

Andrey Dmitriev wrote:I did this, but result is the same


Regardless, this was a necessary step. You cannot mix a script element with both a src attribute and a body.

So now that we are past that, open the Dev Tools and set breakpoints in the code to see where it is not doing what you expect. Let us know what you find.
Welcome to the Ranch

Please debug using the list shown in the ServletsFaq.
2 months ago
Yes. Generally shoes off inside the house.
2 months ago