If I put the alert at the beginning of the function grett, it shows
the alert. After the line "var myAjax = new Ajax.Updater(target, url,
{method: 'get',> parameters: pars});" it doesn't work anymore.
You can see the probleme here: http://fcup.cwsurf.de/ajax/neu/

On 17 Jul., 15:26, Diodeus <[EMAIL PROTECTED]> wrote:
> Try this:
>
> function greet(){
>     alert('working');
>      var url = 'greeting.php';
>      var pars = 'greeting-name='+escape($F('greeting-name'));
>      var target = 'greeting';
>      var myAjax = new Ajax.Updater(target, url, {method: 'get',
> parameters: pars});
>
> }
>
> See if greet is being executed.
>
> On Jul 17, 6:04 am, Thomas <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello!
> > Yesterday I found the prototype script and a tutorial about it in
> > German.
>
> > There was a index.html (see below), the prototype.js, the ajax.js
> > (also below) and a greeting.php (below). In this example there is a
> > input field. If you click in it, the text in the greeting div changes
> > into the inserted text.
> > But now I don't want to click into a input field. I want to click into
> > a picture, which should change automatically into another. So I tried
> > to change the input field into a div field:
> > Instead of  <input id="greeting-name" type="text"> I tried to write
> > <div id="greeting-name"><img src='#' width=100px height=100px></div>.
> > But this doesn't work. What can I do that this script works?
>
> > p.s. sorry for my bad englisch (;
>
> > index.php
> > -------------
> > <head>
> >     <script type="text/javascript" src="prototype.js"></script>
> >     <script type="text/javascript" src="ajax.js"></script>
> > </head>
> > <body>
> >         <input id="greeting-name" type="text">
> >         <div id="greeting"></div>
>
> > ajax.js
> > --------
> > Event.observe(window, 'load', init, false);
> > function init(){
> >      Event.observe('greeting-name', 'click', greet, false);
>
> > }
>
> > function greet(){
> >      var url = 'greeting.php';
> >      var pars = 'greeting-name='+escape($F('greeting-name'));
> >      var target = 'greeting';
> >      var myAjax = new Ajax.Updater(target, url, {method: 'get',
> > parameters: pars});
>
> > }
>
> > greeting.php
> > -----------------
> > <?php
> >      $the_name = htmlspecialchars($_GET['greeting-name']);
> >      echo "<p>$the_name!</p>";
> > ?>- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to