当前位置: 首页 > 工具软件 > GrailsUI > 使用案例 >

grails jq ajax 404,jquery - Grails Ajax URL createLink doesn't work - Stack Overflow

沈伟
2023-12-01

My code snippet is:

$('#PostCode').autocomplete({

source: function (request, response) {

$.ajax({

url: "${createLink(controller:'postcode',action:'getValidPostcodeValues')}",

dataType: "json",

success: function( data ) {

response( $.map( data, function( item ) {

return {

id: item.id,

value: item.name

}

}));

}

});

},

minLength: 1,

select: function (event, ui) {

$('#PostCodeHidden').val(ui.item.id);

}

});

However it doesn't work. I use chrome web tools to track the ajax call url is something like

GET http://localhost:8080/edp-grails/xxx/xxx/$%7BcreateLink(controller:'postcode',action:'getValidPostcodeValues')%7D 404 (Not Found)

Why grails can't interpret the createlink to the actual url?

 类似资料: