Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Ajax calls breaking Confluence

Leroy Elendt January 30, 2013

Hello,

since a while I'm trying to make Ajax-calls happen in Confluence but everytime I do something that is trying to get data from anywhere, even the confluence-API itself, results in an error. I even tried to use the Ajax-example from the Atlassian Developers page with no desired result.

This is an example of code I'm trying to execute:

AJS.$.ajax({
			  url: "/rest/gadget/1.0/filtersAndProjects",
			  type: "GET",
			  data: ({projectsOnly : "true"}),
			  dataType: "json",
			  success: function(msg){
			    alert(msg);
			  }
			});

And this is the error I recieve everytime im trying to make anything remotely related to Ajaxthings:

Cause

org.apache.velocity.exception.ParseErrorException: Encountered "{" at /blabla/email.vm[line 15, column 36] Was expecting one of: <EOF> "(" ... <RPAREN> ... <ESCAPE_DIRECTIVE> ... <SET_DIRECTIVE> ... "##" ... "\\\\" ... "\\" ... <TEXT> ... "*#" ... "*#" ... <STRING_LITERAL> ... <IF_DIRECTIVE> ... <STOP_DIRECTIVE> ... <INTEGER_LITERAL> ... <FLOATING_POINT_LITERAL> ... <WORD> ... <BRACKETED_WORD> ... <IDENTIFIER> ... <DOT> ... "{" ... "}" ... 
    at org.apache.velocity.Template.process(Template.java:141)

Stack Trace:[hide]

org.apache.velocity.exception.ParseErrorException: Encountered "{" at /blabla/email.vm[line 15, column 36]
Was expecting one of:
    <EOF> 
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "##" ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    "*#" ...
    "*#" ...
    <STRING_LITERAL> ...
    <IF_DIRECTIVE> ...
    <STOP_DIRECTIVE> ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <WORD> ...
    <BRACKETED_WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...

followed by a long Stacktrace.

Can anyone help me with this? :(

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Alex Moquia March 18, 2014

old question and you probably worked it out on your own. However I got this issue when my javascript call was directly in my velocity template. the '$' interferes with the server side parsing as both velocity and jquery use this character. I solved it by putting my javascript in a JS file and including it as a web resource.

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 5, 2013

Are you sure this is Confluence? The "filtersAndProjects" gadget is part of JIRA. Have you registered the filtersAndProjects gadget into your Confluence instance?

Could you please post the full stacktrace?

Have you made any customisations to the source of your Confluence installation?

Leroy Elendt February 5, 2013

Hello Joseph,

The filtersAndProjects was just an example. It does'nt matter what API I call, it always errors with that message

I made no customisation to Confluence itself (beside my plugin). In this case its a rather empty .vmd and in the head is the script I mentioned before.

Here is the requested Stacktrace: http://pastebin.com/ZwnvApjU

TAGS
AUG Leaders

Atlassian Community Events