Wednesday, 15 August 2012

jquery - Polling URL and Writing Results to DIV -


I am selecting a URL that asks for the JMS queue for some credit card authorization results. When the URL returns to success, then I want to write the data to the DIV.

Most of my experience is at Java Back-End This is what I have put together, but it is not working.

Am I making a simple mistake here?

  & lt; Script type = "text / javascript" & gt; DoPolling function () {$ .ajax ({url: './poll', datatype: 'jason', type: 'get', success: function (jdata) {console.log (jdata); var jdata = $ ParseJSON (Jdata); if (jdata.pollerStatus == 'poll-again' and jdata.pollerMessage == 'OK') {setTimeout (function () {doPolling ();}, 15000);} else if ( Jdata .pollerStatus == 'done' and & amp; jdata.pollerMessage == 'success') {$ ("# credit card_rates"). Text (jdata);} and if (jdata.pollerStatus == 'done') { Prop ('disabled', false);} and if (jdata.pollerMessage == 'payment-error') {$ ('# submitorder') .prop ('disabled', ' Wrong);} and {$ ('# submitorder') .prop ('disabled', wrong);}}}});} & lt; / script & gt; 

  $ (". #creditcard_results ") text (jdata);   

jdata is an object .text () function only Returns the string that takes a string or callback function.

No comments:

Post a Comment