@Ajax.RouteLink("Make this the default location", "defaultlocation", New With {.id = currentItem.ID}, New AjaxOptions With {.Confirm = "Do you really want to delete this location?", .HttpMethod = "Get", .OnFailure = "alert('some error occured and could not set this location as the default')", .OnSuccess = "$('.defaultbutton').show().$('#defaultlnk" + currentItem.ID.ToString + "').hide()"}, New With {.class = "rounded-6 botton w-142 defaultbutton", .rel = "nofollow", .id = "defaultlnk" + currentItem.ID.ToString})
the problem is that the OnSuccess parameter gets htmlencoded when rendered.
How can I do this without having it encoded?
I dont want to declare an outside function. I really wish to keep all the functionality inside the attribute
this is the rendered output:
<a class="rounded-6 botton w-142 defaultbutton" data-ajax="true" data-ajax-confirm="Do you really want to delete this location?" data-ajax-failure="alert('some error occured and could not set this location as the default')" data-ajax-method="Get" data-ajax-success="$('.defaultbutton').show().$('#defaultlnk492').hide()" href="/Location/MakeDefault/492" id="defaultlnk492" rel="nofollow">Make this the default location</a>
bcweed966
Member
261 Points
893 Posts
help with puting jquery in the OnSuccess parameter of Ajaxoption when using ajax helpers
Feb 29, 2012 11:14 PM|LINK
I am using this ajax helper:
@Ajax.RouteLink("Make this the default location", "defaultlocation", New With {.id = currentItem.ID}, New AjaxOptions With {.Confirm = "Do you really want to delete this location?", .HttpMethod = "Get", .OnFailure = "alert('some error occured and could not set this location as the default')", .OnSuccess = "$('.defaultbutton').show().$('#defaultlnk" + currentItem.ID.ToString + "').hide()"}, New With {.class = "rounded-6 botton w-142 defaultbutton", .rel = "nofollow", .id = "defaultlnk" + currentItem.ID.ToString})subhash.shel...
Contributor
2137 Points
487 Posts
Re: help with puting jquery in the OnSuccess parameter of Ajaxoption when using ajax helpers
Mar 01, 2012 01:31 AM|LINK
hi,
try this....
Subhash
Please, Mark as Answer if this reply helped you.