ron8000 Posted July 7, 2008 Share Posted July 7, 2008 Hello everyone, I'm creating an AJAX Select Box filter for a project, I am using Prototype (latest ver) My goal is when a user makes a selection the JS will send a request to a script and send 1. A formated list of all the select fields 2. The name of the field that was changed. 3. The value of the field that was changed. I've got the php script done, and at the moment to output either. 1. name=value&name=value 2. JSON formated object My issue lies in pulling the vaues by a JS Var. function filterRequestReturn(requestResponse) { var info = requestResponse.responseText; /* For JSON */ var ajax_return = evalJSON(true) /* For the name=value&name=value var ajax_return = info.split('&'); */ var filter_fields = jsFilter.split("-"); filter_fields = filter_fields.without(''); for(var i=0;i<filter_fields.length;i++) { alert(ajax_return.filter_fields[i]); } var oXY2=$('myTestDiv'); oXY2.style.zIndex = '140'; oXY2.innerHTML=ajax_return.total; oXY2.show(); } The line alert(ajax_return.filter_fields); will not work... is there a way to pull values form a JSON object using a var? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.