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

gbeaulacAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
gbeaulacConnect With a Mentor Author Commented:
I answered my own question.

I need to add var rpt = ....
0
 
gbeaulacAuthor Commented:
Needed to add "var rpt = ..."
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.