button text updating

button text updating

jquery mobile 1.2, jquery 1.7.2...

I have an <a> tag that is essentially a phone number, and this is in the data-role="content" div of the page

  1. <div style="float:left;"><a data-theme="c" data-role="button" href="tel:" id="nvphone"></a></div>
 that gets set by a call to JavaScript, lets say GetPhoneNumber(). 

I am using 
  1. $(document).on('pageinit', function()
  2. {
  3.     var navph = GetPhoneNumber);
  4.     $('#nvphone').changeButtonText(navph);
  5. });

  6. // found this funciotn online.....
  7. (function($) {
  8.     /*
  9.      * Changes the displayed text for a jquery mobile button.
  10.      * Encapsulates the idiosyncracies of how jquery re-arranges the DOM
  11.      * to display a button for either an <a> link or <input type="button">
  12.      */
  13.     $.fn.changeButtonText = function(newText) {
  14.         return this.each(function() {
  15.             $this = $(this);
  16.             if( $this.is('a') ) {
  17.                 $('span.ui-btn-text',$this).text(newText);
  18.                 return;
  19.             }
  20.             if( $this.is('input') ) {
  21.                 $this.val(newText);
  22.                 // go up the tree
  23.                 var ctx = $this.closest('.ui-btn');
  24.                 $('span.ui-btn-text',ctx).text(newText);
  25.                 return;
  26.             }
  27.         });
  28.     };
  29. })(jQuery);
When the page gets loaded, the button displays the expected phone number. There are other buttons on the page that load THE SAME page, but change the content. But, for each of those pages, the text of the button becomes empty. If I manually refresh the page, the button text gets set and displayed correctly.

I need for the JavaScript function to be called each time a page is loaded, and I need to make sure the text on the button gets display. Is there a way to force a refresh/reload after the javascript call so that the page gets displayed correctly?

Thx in advance