关于“如何在Ajax载入内容后运行js”有两个以上的问题。他们都建议在Ajax加载完成后运行JS。我知道如何处理。是否有任何js函数在ajax加载内容后运行脚本?
假设超过40页通过Ajax加载页面my-Page.php
。在Ajax加载内容后,是否有像$(document).ready
这样的JS函数来处理运行脚本?
请注意,编辑超过40个文件是不合理的。
多一点点关于我的问题:
我定制糖CRM,而不是使用其简单的JS日历jQuery UI的日期选择器。在Ajax调用中调用$('#inp').datepicker()
失败,因为没有$(#inp)
对象可用。
工作
Calendar.setup ({ldelim}
inputField : "{{$idname}}",
ifFormat : "{$CALENDAR_FORMAT}",
daFormat : "{$CALENDAR_FORMAT}",
button : "{{$idname}}_trigger",
singleClick : true,
dateStr : "{$date_value}",
step : 1,
weekNumbers:false {rdelim} );
doesn't work
jQuery(function() {ldelim}
jQuery('#{{$idname}}_hpm').datepicker({ldelim}
showOn: 'button',
buttonImage: 'include/jdp/styles/images/calendar.png',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy/mm/dd'
{rdelim});
{rdelim});
我不知道它是如何的基本Calendar.setup()
作品,但我的脚本。
我希望你只有一个常用的函数来加载所有40个文件中使用的ajax内容? – Bergi
“请注意,编辑超过40个文件是不合理的。”哇。 – Brad
肯定有可能有一个共同的功能,但这个功能服务于许多其他的Ajax请求。好评@Brad,但有没有可用的功能? – HPM