The only reason the \'s are in the JAVASCRIPT code is because perl
users the $ sign to declare a scalar variable reference. I'm
generating this code completely myself, the problem is this function
is built way before the perl code even starts to run, the perl code is
just putting the data it creates somewhere for javascript to pick it
up later. (Thus the hidden form box). I'm pre-formatting with perl the
way that its dropping it into the box. I'm just looking for a way to
pick this data up from this input box and use it as the postdata.

On Oct 4, 10:52 am, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> The code below is not JavaScript code. It's Perl code. You wouldn't have
> those backslashes in JavaScript code.
>
> That's the problem I was referring to: You're trying to debug JavaScript
> code, but you're not looking at the JavaScript code itself, you're looking
> at the Perl code that *generates* the JavaScript code. That is a recipe for
> confusion.
>
> Anyway, it sounds like you're not giving jQuery's load() function the proper
> format for the data variables. They should be in a JavaScript *object*, not
> a string. Are you expecting Foo and Foo2 to come back to your submit page as
> separate variables with values of 'Bar' and 'Bar2' respectively?
>
> If so, is there any reason you have to put that data in a hidden input
> field? Could your Perl code just write the correct JavaScript object
> directly instead?
>
> The code you'd want (the *JavaScript* code, not the Perl code) would be
> something like:
>
>     var postdata = {
>         Foo: 'Foo2',
>         Bar: 'Bar2'
>     };
>
>     ...
>     $('#query').load( '/theurl', postdata, function() {...} );
>
> That would then do a POST to your URL with the proper data. (You do want a
> POST, not a GET, right?)
>
> -Mike
>
> > From: [EMAIL PROTECTED]
>
> > I'm not trying to debug anything on the perl side, like I
> > said in my original post I'm very new to Javascript, so there
> > is something I'm not getting in javascript that is causing problems.
>
> > I'm creating a string in perl that looks like this "Foo: Bar:, Foo2:
> > Bar2" and I'm writing that to a hidden input box. Then i want
> > jQuery to pick up the string inside the input box and use the
> > value from the input box as the variables for the send
> > request to the .load page.
>
> > However, for some reason its not quite working, here is what
> > I have now that seems to work better, but isn't quite there...
>
> >         if ( \$(e.target).is('.legacy_view') ){
> >                 \$("#loading").toggle();
> >                 var thequery = \$("#legacy_data").val();
> >                 alert (thequery);
> >                 \$("#query").load("/mysite/thepage.pl",
> > thequery, function(){
> >                         \$("#loading").toggle();
> >                 });
>
> > The alert is for debugging, it tells me the correct format
> > and then moves on. I can see on my error log of thepage.pl
> > that it is not getting the values passed to it at all. So
> > something must be wrong in my function. Anyone have any ideas?
>
> > On Oct 3, 11:31 am, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> > > The problem is you're thinking in Perl. Forget Perl. You
> > need to think
> > > in HTML and JavaScript. You're trying to debug both sides
> > at once and
> > > that's not easy.
>
> > > Instead, isolate the two problems. Load your page in the
> > browser and
> > > do a View Source to get the HTML code. Save that to a .html
> > file. It
> > > should load in your browser just like the one generated from Perl.
> > > Tweak the HTML/JavaScript code and get it working.
>
> > > Then, go back to your Perl code and figure out how to generate the
> > > HTML and JavaScript that you've updated. It should be a much easier
> > > task once you know what the working target is.
>
> > > -Mike
>
> > > > From: [EMAIL PROTECTED]
>
> > > > In perl I'm generating the list, e.g. = $helloworld =
> > "hello: var1,
> > > > goodbye: var2", so basically I'm getting this string from
> > the input
> > > > box, and I want to have jQuery use this string rather
> > than expecting
> > > > values, so I want thequery to be evaulated into the list for the
> > > > jquery function to process it.
>
> > > > On Oct 2, 7:29 am, Dave Methvin <[EMAIL PROTECTED]> wrote:
> > > > > >                 \$("#query").load("/mysite/thepage.pl",
> > > > {thequery},
> > > > > > function(){
>
> > > > > In this case the error is right. {thequery} is not a valid
> > > > initializer
> > > > > for an object.
>
> > > > > Maybe you meant {data: thequery} or something like that?
> > > > What is the
> > > > > name of the parameter that your Perl page expects to get
> > > > from the URL
> > > > > querystring?

Reply via email to