Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39825
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Problem with string concatenation |
| Date | 2021-04-01 16:17 +0100 |
| Organization | A little, after lunch |
| Message-ID | <s44o5q$76n$1@dont-email.me> (permalink) |
| References | <9f08800c-e939-4b8f-84b1-86bc871cce0dn@googlegroups.com> |
On 01/04/2021 15:13, Daniele Ferrarese wrote:
> Hello
> I'm still here asking for your help as a beginner.
>
> i'm trying to concatenate arguments of a function with the following string,
>
> onclick="show_cart(<?php echo $variabili[4];?>","<?php echo $variabili[6];?>","<?php echo $variabili[7];?>","<?php echo $variabili[5];?>)"
>
> but i think there are concatenation errors maybe for double quotes or i don't know.
> Could anyone help me? Thanks.
>
> Rgds - Daniele Ferrarese
>
You probably need - unless they are JavaScript declared variables - to
turn your php $varaibili[]'s into strings...
i.e.
args="'$variabili[4]'.,.'$variabili[6]'.,.'$variabili[7]'.'$variabili[5]'"
// so args = 'arg1','arg2', etc...
onclick = "show_cart (<?php echo $args ?>);"
remember JS only takes undeclared *numerical* args without inverted commas.
So this is ok
var one, two;
show_cart(one,two);
and so is
show_cart(1,2);
But you have to do this if one and two are not numbers or declared
show_cart('one', 'two');
In all cases looking at 'show source' in the browser will help see what
JavaScript is seeing and with luck your browser also supports a console,
debugger and error log that can trap JavaScript errors
--
Religion is regarded by the common people as true, by the wise as
foolish, and by the rulers as useful.
(Seneca the Younger, 65 AD)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-01 07:13 -0700
Re: Problem with string concatenation The Natural Philosopher <tnp@invalid.invalid> - 2021-04-01 16:17 +0100
Re: Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-01 08:39 -0700
Re: Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-02 00:37 -0700
Re: Problem with string concatenation JJ <jj4public@gmail.com> - 2021-04-01 22:19 +0700
Re: Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-01 08:40 -0700
Re: Problem with string concatenation Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-01 15:50 +0000
Re: Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-01 23:55 -0700
Re: Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-02 00:25 -0700
Re: Problem with string concatenation Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-02 15:25 +0000
Re: Problem with string concatenation Daniele Ferrarese <daniele.seversrl@gmail.com> - 2021-04-05 23:54 -0700
csiph-web