Hi,
I have defined a javascript function:
function fnSendAssessment(skillTitle, selfAssessment) { var postdata = {'selfAssessment': selfAssessment, 'skillTitle' : skillTitle}; var url = AJS.params.contextPath + "/clientspace/setassessment.action"; AJS.$.ajax({ type: "post", url: url, data: postdata, success: function() { alert("ok"); }, error: function(response) { alert("Uuups!"); } }); //ajax call }
and I will call a XWork Action which is declared in xml (atlassian-plugin.xml):
<action name="setassessment" class="de.twt.confluence.plugins.actions.CaptureSkillsAction" method="setassessment"> <result name="redirect" type="velocity">captureskills.action</result> </action>
but i get always only error back... which is the right way to send ajax requests to XWork Actions? Is there some examples?
Thanks :-)
it works :-)
Would you mind enlighten the rest of us about what was wrong? ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer could someone please tell me how to define this javascript function? I have the following inside my .vm file and get a velocity parse error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<h2>Twikkir Panel</h2> Enter Twikkir message (<span class="smalltext" id="charsleft">140</span>): <br /> <form name="twikkirpost"> <div> <label for="name">Name</label> <input type="text" id="name" name="name"> </div> <div> <label for="time">Time</label> <input type="text" id="time" name="time"> </div> <div> <input id="mybutton" type="button" value="Post It" onclick="postit();"/><br /> </div> </form> <script type="text/javascript"> document.getElementById('mybutton').onclick = function() { var url = AJS.params.contextPath + "/plugins/twikkir/postit.action"; AJS.$.ajax({ type: "post", url: url, success: function() { alert("ok"); }, error: function(response) { alert("Uuups!"); } }); //ajax call } </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.