0

Am using spring mvc and jquery. I want to call a controller method from jsp on change of select tag. I did this using ajax now everything works fine.

But i wish to know is it possible in jquery to call a controller method (Or to hit a url as a normal url hit) without ajax.

Am facing some problem using ajax.

So if there is any better way please help me.

Monicka Akilan
  • 1,501
  • 5
  • 19
  • 42

1 Answers1

0
I want to call a controller method from jsp

You can't do this from jsp, because jsp will compile in servlet on server and this servlet will return an html page to client. So you can do this from html not from jsp.

But i wish to know is it possible in jquery to call a controller method (Or to hit a url as a normal url hit) without ajax.

You can reload your page(for example with form submission). Synchronous ajax call will do the same effect(your page will be blocked until you will not receive the data). This is bad variant. Use normal async call and refresh your view when receive the data instead.

    $.post(remote_url, { param1: value1, param2: value2 }, function(data) { 
       // Refresh view with data
    }); 
mvb13
  • 1,514
  • 3
  • 18
  • 33