TopKatz
5 Feb 2007, 9:26 AM
Hello all!
First Jack has obviously put a termendous amount of work into this framework, and it shows.
I am however having some trouble transitioning from using prototype to Jacks UpdateManager. IM basicaly trying to recreate some old scripts to get the hang of it, and I'm failing to grasp what Im doing wrong.
I have a simple ajax request I did with prototype using ajax.request. It grabs a zip code froma form, and passes it to a php script that does a look up, and returns a string with the city,state. I then split the string and populate two form elemnts with the results.
I have Update.Manager succesfully getting the result, and calling a function, but it does not seem to have be gettign the result, although firebug says Im getting the result.
Here is my code:
function newRequest(){
var el = getEl('zip');
var mgr = el.getUpdateManager();
mgr.update({url:'getCityState.php',params:{ zip: '02148'}, callback: printResult});
}
function printResult(oElement, oResponse){
var response = oResponse.responseText;
alert(oResponse.responseText);
}
Basicaly just sending getCityState.php a zipcode number 02148, it finds Malden,Ma. It returns it, and it should produce an alert that prints the string back. It does not seem as though my result is tied back to my object, however I don't see what Im missing. Can the update.manager function this way? Am I going about this all wrong? Any help would be apreciated.
Katz
First Jack has obviously put a termendous amount of work into this framework, and it shows.
I am however having some trouble transitioning from using prototype to Jacks UpdateManager. IM basicaly trying to recreate some old scripts to get the hang of it, and I'm failing to grasp what Im doing wrong.
I have a simple ajax request I did with prototype using ajax.request. It grabs a zip code froma form, and passes it to a php script that does a look up, and returns a string with the city,state. I then split the string and populate two form elemnts with the results.
I have Update.Manager succesfully getting the result, and calling a function, but it does not seem to have be gettign the result, although firebug says Im getting the result.
Here is my code:
function newRequest(){
var el = getEl('zip');
var mgr = el.getUpdateManager();
mgr.update({url:'getCityState.php',params:{ zip: '02148'}, callback: printResult});
}
function printResult(oElement, oResponse){
var response = oResponse.responseText;
alert(oResponse.responseText);
}
Basicaly just sending getCityState.php a zipcode number 02148, it finds Malden,Ma. It returns it, and it should produce an alert that prints the string back. It does not seem as though my result is tied back to my object, however I don't see what Im missing. Can the update.manager function this way? Am I going about this all wrong? Any help would be apreciated.
Katz