element not changing within an ajax response

Posted on 2011-02-19
Last Modified: 2012-05-11
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);
                      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
			$("#options").css('visibility', 'visible');
			$("#options").css('visibility', 'hidden');
		// check the state of the selector button
		var strButton = $("#selectors").val().split(" ",3);

		if(strButton[0] == "+")
			$("#selectors").val("- "+strButton[1]);

Open in new window

Question by:gbeaulac
  • 2

Accepted Solution

gbeaulac earned 0 total points
ID: 34935975
I answered my own question.

I need to add var rpt = ....

Author Closing Comment

ID: 34935980
Needed to add "var rpt = ..."

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question