Saturday, 14 September 2013

which is the best method to move php code out of js in ajax

which is the best method to move php code out of js in ajax

I am developing an application in Yii.. One issue i am facing is, when i
am writing ajax functions, the url's will be in php. so i am unable to
move the codes to another javascript file.
$.ajax({
url: "<?php echo
Yii::app()->createUrl('provider/ajaxdetail');?>",
data: {'type':tagtype},
beforeSend: function() { },
success: function(data) {
}
});
so what is the best method to move php out of the javascript so that i can
move the javascript code to another js file. I Thought of putting the
url's in a hidden box and then call it in the javascript function. but i
hope there will be better methods to do this .
please help

No comments:

Post a Comment