[jQuery] Re: very simple jQuery not working

2009-12-16 Thread Brett Alton
I was looking for .keyup() not .change(), sorry.

Please ignore.

On Dec 16, 3:37 pm, Brett Alton  wrote:
> 
>         
>                  src="<a  rel="nofollow" href="http://ajax.googleapis.com/ajax/">http://ajax.googleapis.com/ajax/</a>
> libs/jquery/1.3.2/jquery.min.js" charset="utf-8">
>         
>         
>                 
>                         alert('outside');
>                         $('input').change(function() {
>                                 alert('inside');
>                         });
>                 
>                 
>         
> 
>
> Why does the alert with 'inside' never appear?
>
> I tried wrapping it in "$(document).ready(function(){" and it made no
> difference. No errors in Firefox or Chromium too.


[jQuery] jQuery, $.ajax and reCAPTCHA

2009-12-10 Thread Brett Alton
I'm trying to get jQuery to asynchronously load my recaptcha module,
but it doesn't seem to like the fact that "echo recaptcha_get_html
($publickey);" spits out a mixture of HMTL and Javascript.

Here's the code I am trying:


$.ajax({
url: "inc/captcha.php",
cache: false,
success: function(html){
//$("#results").append(alert(html);
$("#results").append(html);
}
});
// This does the same thing
/*$.post("inc/test.php",function(returned_data){
$("#results").append(returned_data);
});*/



It spits me out to a page with _just_ the recaptcha widget. I tested
to see if it was my ajax call by making 'inc/captcha.php' merely say
"Hello!" but it works.

The offending reCAPTCHA code is possibly:

http://api.recaptcha.net/challenge?
k=6Lfz5AkAAKMcQLT5Q8_PrBHNZx4B8v34ABCC">

http://api.recaptcha.net/noscript?
k=6Lfz5AkAAKMcQLT5Q8_PrBHNZx4B8v34ABCC" height="300" width="500"
frameborder="0">





[jQuery] Re: jQuery and $.post with PHP and $_POST

2008-12-24 Thread Brett Alton

Isn't that what $.post is for though?

$("form#test").bind('submit',(function(){
$.post("editcustommenu-new.php",{
menu_bg_colour_selector: $('#menu_bg_colour_selector').val()
});*/
alert('form submitted');
 });

Isn't that supposed to pass 'menu_bg_colour_selector' to $_POST? Or am
I mixing something up...

My alert seems to work, but the $.post function doesn't seem to pass
anything to my PHP code.

On Dec 24, 7:40 am, "Karl Rudd"  wrote:
> Unless a submit button is explicitly pressed it's value won't be sent.
> So in the case given, since there are no other form elements, nothing
> with be posted to the server.
>
> Karl Rudd
>
> On Wed, Dec 24, 2008 at 11:36 PM, Brett Alton  
> wrote:
>
> > How do I get PHP to print JavaScript variables via $_POST? jQuery's
> > $.post doesn't seem to be submitting any data.
>
> > This is a sample of what I have...
>
> > test.php:
> > --
> >  >        echo '';
> >        print_r($_POST);
> >        echo ' > ?>
> > 
> >        
> > 
> > --
>
> > jquery.js:
> > --
> > $(document).ready(function()
> > {
> >        $("form#test").bind('submit',(function(){
> >                $.post("test.php",{
> >                        // no matter what I put in here, nothing shows up in 
> > test.php
> >                });
> >        });
> > });
> > --
>
> > I've also tried:
>
> > $("form#test").submit(function(){
>
> > instead of bind...


[jQuery] jQuery and $.post with PHP and $_POST

2008-12-24 Thread Brett Alton

How do I get PHP to print JavaScript variables via $_POST? jQuery's
$.post doesn't seem to be submitting any data.

This is a sample of what I have...

test.php:
--
';
print_r($_POST);
echo '



--

jquery.js:
--
$(document).ready(function()
{
$("form#test").bind('submit',(function(){
$.post("test.php",{
// no matter what I put in here, nothing shows up in 
test.php
});
});
});
--

I've also tried:

$("form#test").submit(function(){

instead of bind...


[jQuery] Re: Add click() event to each() loop constructor

2008-12-10 Thread Brett Alton

That was too easy. Thank you for the quick response!

$(document).ready(function()
{
$("a[id*='activate-']").each(function(i){
$(this).click(function(){
$('#toggle1-'+i).slideToggle('slow');
$('#toggle2-'+i).slideToggle('slow');
});
});
});

On Dec 10, 1:59 pm, "Brian Cherne" <[EMAIL PROTECTED]> wrote:
> If I understand your question properly, it is possible. Try something like
> this:
>
> $(document).ready(function()
> {
> $("a").each(function(i){
> $(this).click(function(){
> alert(i);
>
> });
> });
> });
>
> Brian.
>
> On Wed, Dec 10, 2008 at 10:29 AM, Brett Alton <[EMAIL PROTECTED]>wrote:
>
>
>
> > Sorry, I'm new to Google Groups and was trying to reply to a post but
> > couldn't figure out how without e-mailing the author directly[1].
>
> > I'm trying to add the click() event to the each() loop constructor.
>
> > e.g.
> > $(document).ready(function()
> > {
> >        $("a[id*='activate-']").each(function(i){
> >                $('#toggle1-'+i).slideToggle('slow');
> >                $('#toggle2-'+i).slideToggle('slow');
> >        });
> > });
>
> > This works, and toggles all corresponding ids called '#toggle1-'+i and
> > #toggle2-'+i, but I only want it to activate when the anchor is
> > clicked. Is this possible?
>
> > [1]
> >http://groups.google.com/group/jquery-en/browse_thread/thread/b6d1dea...


[jQuery] Add click() event to each() loop constructor

2008-12-10 Thread Brett Alton

Sorry, I'm new to Google Groups and was trying to reply to a post but
couldn't figure out how without e-mailing the author directly[1].

I'm trying to add the click() event to the each() loop constructor.

e.g.
$(document).ready(function()
{
$("a[id*='activate-']").each(function(i){
$('#toggle1-'+i).slideToggle('slow');
$('#toggle2-'+i).slideToggle('slow');
});
});

This works, and toggles all corresponding ids called '#toggle1-'+i and
#toggle2-'+i, but I only want it to activate when the anchor is
clicked. Is this possible?

[1] 
http://groups.google.com/group/jquery-en/browse_thread/thread/b6d1dea588cab69d/6b7427b0dd9281d7


[jQuery] Manipulating input fields

2008-09-22 Thread Brett Alton

I'm trying to take the input from one text input field to the next and
I'm not sure how to do it through jQuery. Can someone please send me a
tutorial or example of how to do so?

Right now I have:

$(document).ready(function()
{
$("#agentfirstname").change(function()
{
// take the content from #agentfirstname, set it to lowercase 
and
place it in
// the text field #agentusername

$("#agentusername").val($("#agentfirstname").text().toLowerCase());
alert('Here');
});
});

Where I am trying to take the input from #agentfirstname and put it in
#agentusername. What functions am I to use in jQuery? Should I be
using toLowerCase()? The alert appears to work, so I know jQuery is
capturing the .change, I just need to know how to manipulate input
fields.

The HTML looks like so:




Thanks for all your help!