Я разрабатываю веб-сайт в cakephp.
Все файлы js загрузили страницу просмотра n footer.ctp.
Это моя нижняя страница:
<script type="text/javascript" src="<?php echo BASE_URL;?>js/jquery-1.9.1.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="<?php echo BASE_URL;?>js/modernizr.custom.17475.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>js/jquery.selectbox-0.5.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>js/stickytooltip.js"></script>
<script src="<?php echo BASE_URL;?>js/event-menu.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/custom-sub.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/custom.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/map.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/easyResponsiveTabs.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/jquery.tagcloud.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/html5.js" type="text/javascript"></script>
<script type="text/javascript">
//$('#Select_Access_1').selectbox();
$(function () {
var total_ul_count = "";
if($("#total_ul_count")) {
total_ul_count = $("#total_ul_count").val();
}
if(total_ul_count) {
var arr = total_ul_count.split(',');
$.each(arr, function(key, value) {
$('#Select_Access_'+value).selectbox();
});
}
$(".delete_row").on('click', function () {
var myid = $(this).attr('id');
var my_i_val = myid.substring(13);
delete_subscribe_emails(my_i_val);
$("#li_"+my_i_val).remove();
var count_str = $("#total_ul_count").val();
arr = count_str.split(',');
arr = jQuery.grep(arr, function(value) {
return value != my_i_val;
});
arr_str = arr.join();
$("#total_ul_count").val(arr_str);
});
$(".delete-subscribes").on('click', function () {
var myid = $(this).attr('id');
var my_i_val = myid.substring(7);
delete_notify_emails(my_i_val);
$("#subscribe_"+my_i_val).remove();
var count_str = $("#Subcribes_list_numbers").val();
arr = count_str.split(',');
arr = jQuery.grep(arr, function(value) {
return value != my_i_val;
});
arr_str = arr.join();
$("#Subcribes_list_numbers").val(arr_str);
});
});
</script>
<script src="<?php echo BASE_URL;?>js/common-scripts1.0.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/JQValidation/jquery-1.8.3.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#Add_Organization").validate({
submitHandler: function(form) {
//window.location='http://go.registerguard.com/entertainment/';
alert(1);
return false;
},
});
});
var jQuerX = jQuery.noConflict();
</script>
Теперь все работают, но submitHandler не работает.
Мы сталкиваемся с этими проблемами в первый раз...
Так что это очень странно для меня....
Как я могу это решить, мы также попробовали неконфликт, но все еще есть проблемы.
ОБНОВИТЬ
Мы используем ответные вкладки. Из-за этого возможно или не может работать проверка jquery. Я проверяю проверку jquery, затем вкладки не работают. Если вкладка работала, тогда проверка не работала...
Это страница просмотра:
<div class="clear"></div>
<div class="organization-details-content">
<aside>
<div id="organizationTab">
<?php
if(isset($this->request->data['Organization']) && $this->request->data['Organization']['id'] != "") {
echo $this->Form->input('Organization.id', array('div'=>false,
'label'=>false,
'id'=>'OrganizationId',
'type' => 'hidden',
'class'=>'input-field',
'readonly' => 'readonly'));
} else {
echo $this->Form->input('Organization.id', array('div'=>false,
'label'=>false,
'id'=>'OrganizationId',
'type' => 'hidden',
'class'=>'input-field',
'readonly' => 'readonly'));
}
echo $this->Form->input('Organization.tab2', array('div'=>false,
'label'=>false,
'id'=>'OrganizationTab2',
'type' => 'hidden',
'value'=>$tab2,
'class'=>'input-field',
'readonly' => 'readonly'));
?>
<ul class="resp-tabs-list">
<li id="basicinfo-tab">Basic Information</li>
<li id="analytics-tab">Analytics</li>
</ul>
<div class="resp-tabs-container">
<div id="basicinfo">
<?php echo $this->Form->create('Organization', array('id' => 'Add_Organization','nonvalidate'=>'nonvalidate')); ?>
<div class="organization-details">
<h1>Basic Information</h1>
<p><strong>Your organization will be your public face on Central Ticketing Sales, promotions and reporting will be managed through your organization.</strong></p>
<div class="basic_info">
<ul>
<li><span class="org1"><img src="<?php echo $this->webroot; ?>images/create-org1.png" alt="1" /></span>Create an Organization</li>
<li><span class="event2"><img src="<?php echo $this->webroot; ?>images/create-event2.png" alt="2" /></span>Create an Event</li>
<li><span class="tickets"><img src="<?php echo $this->webroot; ?>images/sell-ticket3.png" alt="2" /></span>Sell Tickets</li>
</ul>
<div class="clear"></div>
</div>
<div class="organization_field">
<label>What is the name of your Organization</label>
<div class="org_field">
<?php echo $this->Form->input('Organization.name', array('div'=>false,
'label'=>false,
'id'=>'name',
'type' => 'text',
'class'=>'input-field')); ?>
<span> This could be the name of your company, non-profit, group, school, etc.</span> </div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="organization-details">
<h2>Contact Information for Central Tickets</h2>
<p>Please enter the email and phone number through which you would like CentralTicket to contact your organization. </p>
<div class="organization_field">
<div class="filed-margin-bottom">
<label class="label-width">Email</label>
<div class="org_field">
<?php
if(isset($this->request->data['Organization']) && $this->request->data['Organization']['company_email'] != "") {
echo $this->Form->input('Organization.company_email', array('div'=>false,
'label'=>false,
'id'=>'company_email',
'type' => 'text',
'class'=>'input-field'));
} else {
echo $this->Form->input('Organization.company_email', array('div'=>false,
'label'=>false,
'id'=>'company_email',
'type' => 'text',
'value'=> '[email protected]',
'onblur'=>"javascript:if(this.value==''){this.value='[email protected]'}",
'onfocus'=>"javascript:if(this.value=='[email protected]'){this.value=''}",
'class'=>'input-field'));
}
?>
</div>
<div class="clear"></div>
</div>
<div class="filed-margin-bottom">
<label class="label-width">Phone</label>
<div class="org_field">
<?php
if(isset($this->request->data['Organization']) && $this->request->data['Organization']['contact_phone'] != "") {
echo $this->Form->input('Organization.contact_phone', array('div'=>false,
'label'=>false,
'id'=>'contact_phone',
'type' => 'text',
'class'=>'input-field'));
} else {
echo $this->Form->input('Organization.contact_phone', array('div'=>false,
'label'=>false,
'id'=>'contact_phone',
'type' => 'text',
'value'=> '+971502504858',
'onblur'=>"javascript:if(this.value==''){this.value='+971502504858'}",
'onfocus'=>"javascript:if(this.value=='+971502504858'){this.value=''}",
'class'=>'input-field'));
}
?>
</div>
<div class="clear"></div>
</div>
<div class="filed-margin-bottom">
<label class="label-width label-hide"> </label>
<div class="button-container">
<?php echo $this->Form->input('Page.step', array('div'=>false,
'label'=>false,
'id'=>'step',
'type' => 'hidden',
'readonly' => 'readonly',
'value'=> 'basicinfo',
'class'=>'input-field')); ?>
<?php echo $this->Form->submit('Save Changes', array('div'=>false,
'name'=>'basicinfo_save',
'id'=>'basicinfo_save',
'type' => 'submit',
'class'=>'org-button')); ?>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<?php echo $this->Form->end(); ?>
</div>
<!--1st Tab conent end here-->
<!--2nd Tab conent end here-->
<div id="analytics">
<?php echo $this->Form->create('Add_Organization_Web', array('id' => 'Add_Organization_Web')); ?>
<div class="organization-details">
<h1>Analytics</h1>
<h3>Google Analytics Tracking </h3>
<p>You can use Google Analytics to track your events. To set up Google Analytics for your organization:</p>
<ul class="tracking-list">
<li>Follow our Google Analytics Tracking How-to to set up your domain.</li>
<li>Enter your Google Analytics Web Property ID below.</li>
</ul>
<p>We will immediately start sending visitor and transaction data to your Google Analytics account. It can take up to a day for your traffic to show up in your Google Analytics account.</p>
<p>Sending visitor and transaction data to Google Analytics relies on the browser of your visitors. There are no guarantees that a visitor browser will have the capabilities required for sending this data to Google Analytics. Some discrepancies may arise between the statistics in Google Analytics and in your Central Ticketing admin.</p>
<div class="organization_field">
<div class="filed-margin-bottom">
<label class="label-width">Web Property ID </label>
<div class="org_field margin">
<?php echo $this->Form->input('Organization.Web_ID', array('div'=>false,
'label'=>false,
'id'=>'Web_ID',
'type' => 'text',
'class'=>'input-field')); ?>
</div>
<div class="clear"></div>
</div>
<div class="filed-margin-bottom">
<label class="label-width label-hide"> </label>
<div class="button-container">
<?php echo $this->Form->input('Page.step', array('div'=>false,
'label'=>false,
'id'=>'step',
'type' => 'hidden',
'readonly' => 'readonly',
'value'=> 'webinfo',
'class'=>'input-field')); ?>
<?php echo $this->Form->submit('Save Changes', array('div'=>false,
'name'=>'webinfo_save',
'id'=>'webinfo_save',
'type' => 'button',
'class'=>'org-button')); ?>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<?php echo $this->Form->end(); ?>
</div>
<!--4nd Tab conent end here-->
</div>
</div>
</aside>
</div>
Я думаю, что вы загрузили библиотеку jquery версии 1.9+
поэтому не нужно снова загружать другую библиотеку. Увидимся:
<script type="text/javascript" src="<?php echo BASE_URL;?>js/jquery-1.9.1.min.js">
</script>
библиотека уже загружена, поэтому вам не нужно загружать эту библиотеку:
<script src="<?php echo BASE_URL;?>js/JQValidation/jquery-1.8.3.js" type="text/javascript">
</script>
и вы можете попробовать изменить эту строку:
jQuery(document).ready(function($) {
js/JQValidation/jquery-1.8.3.js
если бы вы могли показать, что у вас есть в этом файле. Это библиотека JQuery или у вас есть некоторые пользовательские JQuery, написанные в этом файле.
<script src="<?php echo BASE_URL;?>js/JQValidation/jquery-1.8.3.js" type="text/javascript"></script>
я думаю, что в этом нет необходимости, поскольку вы загрузили библиотеку jquery уже.