Page 1 of 1

php and jquery

Posted: Sun Aug 29, 2010 8:55 pm
by scifirocket
so i have this "class" defined in a javascript file, "a.cross-link". This enables the ability for users to navigate the webpage in a slider format. it works fine if I directly place the required html code:
[text]<a class="cross-link" href="#3" title="Go to Page 2">View Results</a>[/text]

but if i have php print out that line for me, it doesn't work:

Code: Select all

echo "<a class= \"cross-link\" href=\"#3\" title=\"Go to Page 3\">$name</a>";
(Where $name is some variable)

i dont know what more information you may need, so please ask. Thanks.

Re: php and jquery

Posted: Sun Aug 29, 2010 10:57 pm
by requinix
Pretty sure there's more to it than that. What's the PHP code around that, and what HTML are you trying to generate?

Re: php and jquery

Posted: Sun Aug 29, 2010 11:28 pm
by scifirocket
the php code is just your average sql stuff. here is an interesting observation i've made:

if i "hardcode" this this into the html: <a class="cross-link" href="#3" title="Go to Page 3">View Results</a>
and then i go to generate the sourcecode, this is what appears (this works): <A class=cross-link title="Go to Page 3" href="#3" jQuery1283131847233="30">View Results</A>

but if i have the html made by a php echo statement, it just stays the same - i dont get a jQuery1283131847233="30" generated in the sourcecode.

i'm sorry i'm having difficulty describing the problem. i'm new to jquery and ajax stuff. to me, it seems like the "cross-link" class i have defined in the javascript isn't being applied to correctly. i have no idea. can you invoke javascript from a php echo statement that is formatted to produce html code?

Re: php and jquery

Posted: Thu Sep 02, 2010 4:08 pm
by scifirocket
let me ask a simpler question: what are the differences between the two code segments (other than the obvious) in terms of their output?:

[text]<a class="cross-link" href="#3" title="Go to Page 2">View Results</a>[/text]

Code: Select all

echo "<a class= \"cross-link\" href=\"#3\" title=\"Go to Page 3\">$name</a>";

Re: php and jquery

Posted: Sun Sep 05, 2010 3:26 pm
by scifirocket
here is an example of the problem (and how to produce it):

1) go to http://eataustineat.com/testfolder/index.php
2) type in an 'a' into the text field
3) click "view results"
4) select the first result (ie: Dog Almighty)

Notice the javascript slide doesn't happen. In fact, nothing appears to happen. It is suppose to slide the content to the left much like it did when you hit "view results".

I hope this clears the problem up some.