Ajax returns empty

Ajax returns empty

Hi there,

I have an ajax request on my page. I have a select form element on my page, named sz1, the ossz text input's value should be altered.

  1. $(document).ready(function () {
  2. $('[name="sz1"]').change(function () {
  3.         var szolgjs = $(this).val();
  4.         var dataString = 'szolgjs=' + szolgjs;
  5.         $.ajax({
  6.             type: "POST",
  7.             url: "urlapar.php",
  8.             data: dataString,
  9.             cache: false,
  10.             success: function (html)
  11.             {
  12.                 $('[name="ossz"]').val(html);
  13.             }
  14.         });
  15. });
  16. });


The urlapar.php:

  1. <?php
  2. include("connect.php");
  3. if($_POST['szolgjs']) {
  4.     $szolg = $_POST['szolgjs'];
  5.     $szquery = "SELECT ar FROM szolgaltatasok WHERE szolgaltatas = '$szolg'";
  6.     $szsql = mysql_query($szquery) or die(mysql_error());
  7.     $szkiiras =  mysql_fetch_array($szsql,MYSQL_ASSOC);
  8.     echo $szkiiras['ar'];
  9. }
  10. ?>


The joke is that I have another ajax request on the page, which is almost the same, and it's working well. I supposed that the two ajax request might interfere, so I deleted the one which was working, the other was still not working. I noticed that in fact ajax affects the ossz text field, but it's deleting the value which is written there, so I think it's returning null. Thus I have tested my SQL query, and echoed it on the original page, it was working flawlessly. So I have no idea, please help.
Thank you in advance!

Kazi