Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL][AJAX]Problem z formularzem, Właściwie, to tylko ze zemiennymu
-Gość-
post
Post #1





Goście







Mam poważny problem.

Uczę się AJAXa i napotkałem problem. Korzystam z jQuery.

Mam taki kod, który wysyła formularz:
  1. <?php
  2. <script type="text/javascript">
  3. $(function() {
  4.  $('.error').hide();
  5.  
  6.  $(".submit").click(function() {
  7.    $('.error').hide();
  8.        
  9.      var comment = $("textarea#comment").val();
  10.        if (comment == "") {
  11.      $("label#comment_error").fadeIn();
  12.      $("textarea#comment").focus();
  13.      return false;
  14.    }
  15.  
  16.    var comment = $("textarea#comment").val();
  17.    var dataString = 'comment='+ comment;
  18.    //alert (dataString);return false;
  19.        
  20.      $.ajax({
  21.      type"post",
  22.      url"/../modules/comment.php",
  23.      datadataString,
  24.      success<span style="color: #007700": function() {
  25.        $('div#comment_list').html("<div id='message'></div>");
  26.        $('#message').html("<h2 style='text-alig:center'>Your comment has been submitted!</h2>")
  27.        .hide()
  28.        .fadeIn()
  29.      }
  30.     });
  31.    return false;
  32.    });
  33. });
  34. </script>
  35. ?>


Działa dobrze... tylko... jak wysyłać za pomocą AJAXa inne zmienne? Takie które nie pochodzą z pól formularza?
Go to the top of the page
+Quote Post

Posty w temacie
- Gość   [PHP][MYSQL][AJAX]Problem z formularzem   22.09.2008, 14:48:19
- - lord_t   Patrz data: Kod$.ajax({ type: ...   22.09.2008, 18:15:51
|- - Gość   Cytat(lord_t @ 22.09.2008, 18:15:51 )...   22.09.2008, 18:49:57
- - lord_t   W pliku php, który wywołasz odbierasz je tak jakby...   22.09.2008, 20:31:01


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 14:31