This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

[jQuery] Ajax request problem with safari

Forum to discuss ExtJS and other JS plugins

[jQuery] Ajax request problem with safari

by lolitarh » Mon Oct 12, 2009 5:28 pm

hello everybody,

i got a problem using some AJAX to save user's skills using checkboxs

it works fine on firefox but on safari the skills are not saved.

here is the template :

Code: Select all
<div id="skillLink" style="visibility: hidden">
<?php echo url_for('@profil_save_skill') ?>
</div>


here is the action:

Code: Select all
public function executeSaveSkill(sfWebRequest $request) // Ajax request to save the skill. No template is associate.
   {
      $name = $request->getParameter('name');
      $id_user = $this->getUser()->getSubscriberId();

      $match = '';
      preg_match("#^skill\[(.*)\]$#Usmi", $name, $match);
      
      $skill = Doctrine::getTable('Skill')->verifExistSkill($id_user, $match[1]); // Check if the skill already exist. Match[1] is the real name (in the form : name = skills['*REAL NAME*'])
      if ($skill)
      {
         
         $skill->delete(); // If he already exist, we delete it.
         exit();
         //$this->setLayout(false);
      }

      $skill = new Skill(); // Else we create it.
      $skill->setName($match[1]);
      $skill->setUserId($id_user);
      $skill->save();
      //$this->setLayout(false);
      exit();
   }


by the way, i can't suppr the exit because with setLayout(false) my skills aren't saved also.

here is the javascript file:

Code: Select all
$(document).ready(function()
{
   $("form ul li input").click(function() // ajax fonction to load in database the skill
   {
      $.ajax({
      url: $("#skillLink").html(),
      type: "POST",
      data: { name: $(this).attr('name') },
      });
   }

//      $.post($("#skillLink").html(), { name: $(this).attr('name') } );
   //});
   
   
   //skills' animations
   
   $("form > ul ul").hide(); //hide all the list of skills

   $("input:checked").parent().next().children().not("input").not('label').slideDown("slow"); // show skill who have been selected before

   $("input:checked").parents('ul').slideDown("slow");
   
   $("form ul li input").click(function() // on click show the child list (if there is one).
   {
      $(this).parent().next().children().not("input").not('label').slideDown("slow");
   })
})




im a beginner with AJAX so if you want me to do some test in order to resolve this it will be a pleasure for me (already got firebug for firefox and web inspector for safari)

thanks you
lolitarh
Junior Member
 
Posts: 1
Joined: Mon Oct 12, 2009 5:11 pm