1

![enter image description here][1] Hi I am getting server data from web socket but i am facing one problem that i need to show current time in the from to front of web service data as show ..I am able to show data but time is not in front of that..:(

How to show time in front of data.

I am using like this

function nativePluginResultHandler (result)
{
      $('#realTimeContents' ).append('<p>'+result+'</p>');

}

enter image description here !

enter image description here

user2563256
  • 187
  • 1
  • 5
  • 14

2 Answers2

1

From this answer: How to get current time in jquery mobile or jquery

Why wouldn't taking your server's appended results and then prepending with the javascript time stamp work?

  $('#time').prepend("<b>" + hours + ":" + minutes + " " + "</b>");
Community
  • 1
  • 1
tessaract
  • 211
  • 1
  • 6
0

Try something like this:

function date() {
    var now = new Date(),
        now = now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
    $('#time').html(now);
}

Fiddle: http://jsfiddle.net/u32pU/2/

Josh
  • 2,835
  • 1
  • 21
  • 33