Link to home
Start Free TrialLog in
Avatar of gbeaulac
gbeaulac

asked on

element not changing within an ajax response

I have a web page that calls an $.ajax which returns a <div> with a <select> . Then when I select an option The onchange in jQuery is not responding. I know the .live method should help but it isn't helping.

$("#ViewBasedOnSelect").live('change', function(){
		var ViewBasedOn = $(this).val().split("_",3);
		alert(ViewBasedOn[2]);
		$.ajax({
                      type: "POST",
                         url: "ajaxSelectors.php?datagroup="+ViewBasedOn[2]+"&category="+ViewBasedOn[1]+"&ID="+ViewBasedOn[0],
   data: $("form[name=frmViewBasedOn]").serialize(),
   success: function(msg){
		$("#jSelectors").html(msg);   }
		});
		// end of selectors		
		//get the value and determine if 'e' for entity or 'a' for attribute
		// if entity we show the option button
				
		if(ViewBasedOn[1]=='e')
		{
			$("#options").css('visibility', 'visible');
		}
		else
		{
			$("#options").css('visibility', 'hidden');
		}
		
		// check the state of the selector button
		var strButton = $("#selectors").val().split(" ",3);

		if(strButton[0] == "+")
		{
			$("#selectors").val("- "+strButton[1]);
			$("#rowSelectors").show();
		}
		
		this.blur();
	
}
);	

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of gbeaulac
gbeaulac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbeaulac
gbeaulac

ASKER

Needed to add "var rpt = ..."