weirder still -

if I add an alert after the .ajax then the alert callback fires - ?

---------------

$.ajax({
type: "POST",
url: "tajax.php",
data: "name=John&headline=blag+blag",
//dataType: "html",
success: function(msg){
  alert( "Data Saved: " + msg );
}
alert("si");
});

-----------
and both alerts are shown -  'si' first.

Obviously I'm missing something basic here. I'll stop cluttering the
board and get back if I figure it out.

On May 13, 12:50 am, jsnewbie <opencityinteract...@gmail.com> wrote:
> Variables are reaching the php but callback isn't firing. Multiple
> forms on the page - I've stripped out everything extraneous to try and
> get a callback. (strangely Firefox 3.0.10 hits the php but breaks
> while running Firebug(?) and doesn't seem to work in Safari 3.1.2)
>
> Sorry if this is covered but been searching and can't solve. php
> included in case I'm doing something wrong there (as well?) javascript
> always breaks when I get my hands on it ;<
>
> ..... (XHTML 1.0 Transitional) ....
>
> <script type="text/javascript" src="jquery-1.3.2.js"></script>
>
> <SCRIPT language="JavaScript">
>
> function submitForm(src) {
>
> $.ajax({
> type: "POST",
> url: "tajax.php",
> data: "name=John&headline=blag+blag",
> //dataType: "html",
> success: function(msg){
>   alert( "Data Saved: " + msg );
>
> }
> });
> }
>
> </SCRIPT>
>
> </head>
>
> <body>
>
> <form id="1242105450">
> <input type="submit" value="publish" onclick=submitForm(this.form); />
> <input type="radio" name="ok" value="yes" />yes
> <input type="radio" name="ok" value="no" />no<br />
> </form>
> <hr />
>
> <form id="1242115036">
> <input type="submit" value="publish" onclick=submitForm(this.form); />
> <input type="radio" name="ok" value="yes" />yes
> <input type="radio" name="ok" value="no" />no<br />
> </form>
> <hr />
>
> <form id="1242159405">
> <input type="submit" value="publish" onclick=submitForm(this.form); />
> <input type="radio" name="ok" value="yes" />yes
> <input type="radio" name="ok" value="no" />no<br />
> </form>
> <hr />
>
> ...............
>
> <?php
>
> $nm = "log";
> $log = fopen($nm, "a");
> fwrite($log, "tajax.php\n");
>
> $name=$_POST['name'];
> $headline=$_POST['headline'];
>
> fwrite($log, $name);
> fwrite($log, "\n");
> fwrite($log, $headline);
>
> echo "<b>Done</b>";

Reply via email to