tags:

views:

35

answers:

4

Hi there.

I have the following javascript function:

<script type="text/javascript">
   function quickCardRegister_OnCompleteSave() {

      publishContent('This is a description',#{imagePath},'http://www.lala.com');
   }
</script>

The imagePath variable is populated with value: http://localhost/img/30_w130px.gif

I'm having the following script error: missing ) after argument list

publishContent('This is a description',http://localhost/img/30_w130px.gif,'http://www.lala.com');

How can i surround http://localhost/img/30_w130px.gif with quotes?

Thanks

A: 

What about the missing '}' at the end for the function just before the closing script tag?

<script type="text/javascript">
   function quickCardRegister_OnCompleteSave() {

      publishContent('This is a description',#{imagePath},'http://www.lala.com');
   }
</script>
zaf
A: 

Try

publishContent('This is a description','"' + #{imagePath} + '"','http://www.lala.com');
Fermin
A: 

You are missing } for your function as well as + for javascript concatenation:

<script type="text/javascript">
   function quickCardRegister_OnCompleteSave() {

      publishContent('This is a description' + #{imagePath} + 'http://www.lala.com');
   }
</script>

And I assume #{imagePath} something you would replace dynamically.

Sarfraz
Forget it .... that's not the problem, it was a typo to paste here.
João Madureira Pires
A: 

Seems like you are in some kinds of template language..

Have you try quote at #{imagePath} ?

<script type="text/javascript">
function quickCardRegister_OnCompleteSave() {

  publishContent('This is a description','#{imagePath}','http://www.lala.com');
}
</script>
Bird