Jump to content

greensteam

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by greensteam

  1. It's not public yet - I don't want to post the link here and make it public. If you think you can help, I can send you the link by email.
  2. var KFL_Nav_Rates = function() { var nav_prev_selected; var init = function() { jQuery('#dailynav-funds').change(function(){ var selected_val = jQuery(this).val(); var selected_name = jQuery(this).find('option:selected').text(); var previous_selected = nav_prev_selected; if( selected_val != 0 ) { var self = this; jQuery(self).attr('disabled', true); jQuery(self).parents('.dailynav').fadeTo(0, 0.2); jQuery.ajax({ url:nav_rates_config.ajaxurl, type:'POST', data:{"action":nav_rates_config.action, "nav_symbol":selected_val}, dataType:'json', success:function( response ) { if( response.status == 1) { jQuery( '#price-offer' ).text( response.data.offer_price ); jQuery( '#price-red' ).text( response.data.nav_price ); jQuery( '.navdate' ).text( response.data.nav_date ); jQuery( '.fundname' ).text( selected_name ); if( typeof response.data.red_load != 'undefined' ) { jQuery( '#red-load span' ).text( response.data.red_load ); jQuery( '#red-load' ).show(); } else { jQuery( '#red-load' ).hide(); } } else { alert( 'Please try again later' ); jQuery(self).val(previous_selected); } }, error:function() { alert( 'Please try again later' ); jQuery(self).val(previous_selected); }, complete:function() { jQuery(self).parents('.dailynav').fadeTo(0, 1); jQuery(self).attr('disabled', false); } }); } }); jQuery('#dailynav-funds').focus(function(){ nav_prev_selected = jQuery(this).val(); }); }; return { init: init } }(); jQuery(function(){ KFL_Nav_Rates.init(); });
  3. Hi, I am hoping someone can help me out with a slight issue I have with php and mySQL. I have an ajax-powered form with a select (dropdown) field populated through a php function. Based on the user-selected values in this field, data is displayed on the webpage; i.e. selected value 1 returns values x and y on the page. I am now trying to call additional data (value z) from a different table in the same database, and as before, use the selected values from the dropdown to display the data. For some reason, value z is not changing according to the user-selected value. This is my code: [The function to populate the select field] function kfl_get_funds_names() { $result = array(); $result['CDF'] = 'Crosby Dragon Fund'; $result['CPF'] = 'Crosby Phoenix Fund'; $result['AMZPIF'] = 'AMZ Plus Income Fund'; $result['KASBIIF'] = 'KASB Islamic Income Opportunity'; $result['KASBCPGF'] = 'KASB Capital Protected Gold Fund'; $result['KASBLF'] = 'KASB Income Opportunity Fund'; $result['KASBCF'] = 'KASB Cash Fund'; $result['KASBBF'] = 'KASB Asset Allocation Fund'; $result['KASBSMF'] = 'KASB Stock Market Fund'; return $result; } [the code calling and using the function to interact with the database] $funds_to_display = kfl_get_funds_names(); $current_symbol = key( $funds_to_display ); $current_nav_rates = kfl_get_latest_rates( $current_symbol ); [the code calling additional data, value z, from the database, and using the info in the select field to filter it] $cutoff = kfl_cutoff( $current_symbol ); The display of each of these items is as follows: <?php echo $current_nav_rates['nav_date']; ?> <?php echo $funds_to_display[$current_symbol]; ?> <?php echo $cutoff['cutoff']; ?> I can't get the $cutoff code to display the correct values. It picks up the first symbol to display and doesn't change with user selection. The code for the selection box, by the way: <select id="dailynav-funds" autocomplete="off" name="dnf"> <?php foreach ($funds_to_display as $fund_symbol => $fund_name) { echo '<option'; if( $fund_symbol == $current_symbol ) { echo ' selected="selected"'; } echo ' value="' . $fund_symbol . '">'; echo $fund_name; echo '</option>'; } ?> </select> I've tried to get data using $_GET['dnf'] into the cutoff code, but that throws up parse errors. What am I doing wrong, and how can I resolve this issue? Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.