Topic: Including a .js in a xajax function

I'm stucked,

I need to include a .js file into my xajax function.. I did this:


$salidaForm="<script src=\"../funciones/calendario/mootools-core-1.3.2-full-compat.js\" type=\"text/javascript\"></script>"; //$camposForm['numProyecto'];

$salidaForm.="<script language=\"javascript\" src=\"../funciones/calendario/datepicker.js\"></script>";

$salidaForm.=".....";

$resulProyecto=new xajaxResponse();
$resulProyecto->assign("infoProy","innerHTML",$salidaForm);

return $resulProyecto;

Can anybody tell me if i'm wrong,. and if it's true,.. please show me how to do it well.

Thanks

Re: Including a .js in a xajax function

Hi,

try $resp->includeScript($sFileName, $sType = null, $sId = null)

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Including a .js in a xajax function

One more doubt,... I have this code:....

$opcion.="<select name=\"meta\" id=\"meta\" style=\"font-family:Verdana; font-size:11px; max-width:730px; color:#FF2000\">";
        do {
            $opcion.="<option value=\"".$row_listaMetas['co_meta']."\" selected onmouseover=\"showmeta(event,'".$row_listaMetas['desc_meta']."')\" onmouseout=\"hiddenDiv()\">".substr($row_listaMetas['desc_meta'],0,100)."</option>";
            //$newtext = wordwrap($text, 20, "<br />\n");
            //substr($row_listaMetas['desc_meta'],0,180)
        } while ($row_listaMetas = mysql_fetch_assoc($listaMetas));
        $rows = mysql_num_rows($listaMetas);
        if($rows > 0)
        {
            mysql_data_seek($listaMetas, 0);
            $row_listaMetas = mysql_fetch_assoc($listaMetas);
        }
        $opcion.="</select>";


within a XAJAX function,... could you please tell me what to do for showmeta() and hiddenDiv() to make them work,.. they are both javascript functions,....I appreciate any support.-


Thanks

Re: Including a .js in a xajax function

I tried to answer your question in your other post but I probably missed the point.

To make those functions work you need to put the functions showmeta and hiddenDiv  inside of a <script> tag in the page <head>.

<head>
...
<script type ="text/javascript>
function showmeta(){......}

function hiddenDiv(){.......}
</script>

Hopes this helps.

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Including a .js in a xajax function

I tried to answer your question in your other post but I probably missed the point.

To make those functions work you need to put the functions showmeta and hiddenDiv  inside of a <script> tag in the page <head>.

<head>
...
<script type ="text/javascript>
function showmeta(){......}

function hiddenDiv(){.......}
</script>
...
</head>

Hopes this helps.

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.