This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » Javascript plugins » [jQuery] Ajax request problem with safari
[jQuery] Ajax request problem with safari [message #86533] Mon, 12 October 2009 17:28
lolitarh  is currently offline lolitarh
Messages: 1
Registered: October 2009
Junior Member
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 :

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


here is the action:

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:

$(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
Previous Topic:[jQuery] How to use the Tabs?
Next Topic:sfMilonicPlugin
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software