Grails formRemote 404 Not Found -


i'm having difficulties getting ajaxform working properly. i'm using grails 2.4.4 , have following remoteform code.

view usedproducts

<div id="updateme">     <g:each in="${productlist}" var="product">         ${product.item} success1     </g:each> </div>  <g:formremote name="myform"     url="[controller:'product', action: 'save']" update="updateme">     <g:textfield name="item" required="" value="${newproduct?.item}" />     <g:submitbutton name="save" /> </g:formremote> 

controller productcontroller

def usedproducts = {     [productlist:product.findall()] }  @transactional def save(product productinstance) {     productinstance.save flush:true      [productlist: product.findall()] } 

console error

post http://localhost:8080/tekdays/product/save

404 not found 54ms
jquery-...e=false (line 9631) "networkerror: 404 not found - http://localhost:8080/tekdays/product/save"

i'm afraid cannot way you're trying do.

note when ajax call being performed user there no more gsp tags. there css, html , javascript. it's browser world.

please put render in front of you're returning , test.

@transactional def save(product productinstance) {     productinstance.save flush:true         render product.findall()    } 

you'll see content of div updateme replaced content rendered save method. content list returned findall method product objects.

when use render content returned (a gsp template, content of variable or html) rendered in current html, instance, through ajax call.

for other side when use return keyword expected gsp same name controller method. because of you're getting 404, since save.gsp isn't found. note: if omit return keyword (as you're doing) groovyc (groovy compiler) implicitly put you.

if understand you're trying must render content (not return it).


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -