Problem with javascript and php page..

Hi guys, how do I get to run a php page into a javascript?

Outside the framework yii I can make it happen, now within the framework of several shapes and tried with no success!

I tried to create a widget for this too and nothing! someone give me a light?

The following code:




$(document).ready(function(){

   

   $("#montadora").change(function(){

      $.ajax({

         type: "POST",

         url: "busca.php", //-> Here I think the problem is, I can not call this framework within the page at all!

         data: {montadora: $("#montadora").val()},

         dataType: "json",

         success: function(json){

            var options = "";

            $.each(json, function(key, value){

               options += "<option value=" + key + ">" + value + "</option>";

            });

            $("#veiculo").html(options);

         }

      });

   });



Sorry for my bad English…

Thanks

The problem is with the url. If you place busca.php in the root folder of your project, it will work. But it is not recommended to proceed this way. Check the link below:

http://www.yiiframework.com/forum/index.php/topic/31284-post-not-working/page__p__150653__fromsearch__1#entry150653

I also tried putting the file in the root of the app, but still did not work!

What does busca.php do ?

You should first make that work from the browser address line and then use that address in your code.

hi, I managed to solve the problem … was an oversight of a quote in javascript code

thank you

Just for the record, you seem to diverge from the MVC good pratices(based on the code posted) and routing conventions.

Try to use:

url: ‘<?php echo Yii::app()->createAbsoluteUrl(“ControllerID/ActionID”); ?>’