• Hi everybody, i’m working on one project, where we got shortcode TLD, this is a table in admin panel where we got different prices, so i’ve got a trouble, this table is huge, at the beginning when i’m filling it, everything is okay, but when this table is getting huge and i push update button, it is updating infinitely and in console i’ve got this error :

    Uncaught TypeError: Cannot read property ‘length’ of undefined jquery.js?ver=1.11.1:2

    how can i solve this problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    How is the shortcode being created? Is it from a plugin and if so which one? Is it from a theme?

    Thread Starter Wahtel

    (@wahtel)

    This is two shortcodes which creating this table

    add_shortcode( 'tld', 'deco_tld_tabs_shortcode' );
    function deco_tld_tabs_shortcode( $attr = array() ) {
    	$id = $attr['id'];
    
    	$service_tabs = get_field( 'deco_tld_type_service', $id );
    
    	ob_start();
    	?>
    	<div class="wrap">
    
    		<div class="dp-heading">
    
    			<div class="dph-price">
    
    				<?php _e( '<!--:ru-->Стоимость услуг<!--:--><!--:ua-->Стоимость услуг<!--:--><!--:en-->Стоимость услуг<!--:-->' ); ?>:
    
    				<div class="dp-lang-drop">
    					<span>UAH</span>
    
    					<ul>
    						<li class="current" data-c="ua">UAH</li>
    						<li data-c="en">USD</li>
    					</ul>
    				</div>
    
    			</div>
    
    			<div class="face-tabs">
    				<a class="current" href="#" data-tab="f1"><?php _e( '<!--:ru-->Для физ.лиц<!--:--><!--:ua-->Для физ.лиц<!--:--><!--:en-->Для физ.лиц<!--:-->' ); ?></a>
    				<a href="#" data-tab="f2" id="f2"><?php _e( '<!--:ru-->Для юр.лиц<!--:--><!--:ua-->Для юр.лиц<!--:--><!--:en-->Для юр.лиц<!--:-->' ); ?></a>
    			</div>
    
    		</div>
    
    		<ul class="dp-nav">
    			<?php
    			$i = 0;
    			foreach ( $service_tabs as $item ) {
    				foreach ( $item['type_domain_zone'] as $item2 ) {
    					$i ++;
    					?>
    
    					<li>
    						<a data-tab-scroll="<?php echo $i; ?>"
    							<?php echo ( $i == 1 ) ? 'class="current"' : ''; ?> href="#">
    							<?php echo $item2['tab_zone_name']; ?></a>
    					</li>
    				<?php
    				}
    				break;
    			} ?>
    		</ul>
    
    		<div class="domain-tab">
    
    			<ul class="dp-tab-nav">
    				<?php
    				$i = 0; //print_r($service_tabs);
    				foreach ( $service_tabs as $item ) {
    					$i ++;
    					?>
    					<li><a href="#"
    					       data-tab-show="t<?php echo $i; ?>"
    							<?php echo $i == 1 ? 'class="current"' : ''; ?>><?php echo $item['service_tab_title']; ?></a>
    					</li>
    				<?php } ?>
    			</ul>
    
    			<div class="dp-tab-content">
    
    				<div class="dptc-item active" data-tab-show="f1">
    					<?php deco_tld_echo_html_for_fiz_or_yur_mens( 'fiz', $service_tabs ); ?>
    				</div>
    
    				<div class="dptc-item" data-tab-show="f2">
    					<?php
    					deco_tld_echo_html_for_fiz_or_yur_mens( $type = 'yur', $service_tabs ); ?>
    
    				</div>
    
    			</div>
    
    		</div>
    
    	</div>
    	<?php
    	$res = ob_get_contents();
    	ob_end_clean();
    
    	return $res;
    }
    
    function deco_tld_echo_html_for_fiz_or_yur_mens( $type = 'fiz', $service_tabs = array() ) {
    
    	$i = 0; //print_r($service_tabs);
    	foreach ( $service_tabs as $item ) {
    		$i ++;
    		?>
    
    		<div class="dp-dts<?php echo $i == 1 ? ' active' : ''; ?>" data-tab-show="t<?php echo $i; ?>">
    
    			<table class="dptc-head">
    				<tr>
    					<th><?php echo $item['service_title_in_table']; ?></th>
    					<th>1+</th>
    					<th>20+</th>
    					<th>50+</th>
    				</tr>
    			</table>
    			<?php
    			$type_domain_zone_num = 0;
    			foreach ( $item['type_domain_zone'] as $item2 ) {
    				$type_domain_zone_num ++;
    				?>
    				<div class="dp-trigger<?php echo $type_domain_zone_num == 1 ? ' active' : ''; ?>" data-tab-scroll="<?php echo $type_domain_zone_num; ?>">
    					<span><?php echo $item2['toggle_zone_name']; ?></span>
    				</div>
    				<div class="dp-table">
    					<table>
    						<?php foreach ( $item2['zone_and_cost'] as $item3 ) { ?>
    							<tr>
    								<td class="dp_f">
    									<?php echo $item3['domain_name']; ?>
    									<?php if ( $item3['discount'] ) { ?>
    										<span class="tip-akciya">
    										<?php _e( '<!--:ru-->Акция<!--:--><!--:ua-->Акцiя<!--:--><!--:en-->Discount<!--:-->' ); ?>
    										</span>
    									<?php } ?>
    								</td>
    								<td>
    									<?php
    									echo ( $type == 'fiz' ) ? $item3['cost_1_fiz'] : $item3['cost_1_yur'];
    									?>
    								</td>
    								<td><?php
    									echo ( $type == 'fiz' ) ? $item3['cost_20_fiz'] : $item3['cost_20_yur'];
    									?>
    								</td>
    								<td>
    									<?php
    									echo ( $type == 'fiz' ) ? $item3['cost_50_fiz'] : $item3['cost_50_yur'];
    									?>
    								</td>
    							</tr>
    						<?php } ?>
    					</table>
    				</div>
    			<?php } ?>
    		</div>
    	<?php }
    
    }

    Is it from a plugin and if so which one? Is it from a theme?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Uncaught TypeError: Cannot read property 'length' of undefined’ is closed to new replies.