How to get the blackberry uuid using javascript and web works - javascript

I am trying to find the device UUID using javascript with web works for devices with OS 7 and less.
The code I am using:
function getIdentityData(){
$.ajax({
type: "get",
url: "http://localhost:8472/blackberry/identity/get",
success: function(msg){
alert(msg);
}
});
}
as found in their documentation is not working, I never get the alert? https://developer.blackberry.com/html5/apis/blackberry.identity.phone.html
I have the following in my config file
<rim:permit>read_device_identifying_information</rim:permit>
<feature id="blackberry.identity.phone" />

Have you tried just blackberry.identity.PIN as documented here - https://developer.blackberry.com/html5/apis/blackberry.identity.html#.PIN

Related

Changes made in .js not being reflecting when I debug in Visual Studio

I'm trying to debug problems in a javascript file. When I make a change to the file and start the Visual Studio Debugger (F5) a [dynamic] version of the javascript file shows up in the debugger and stops at my break point, but the change I made to the file is not reflected in the [dynamic] version. For example, here is the function in the javascript file:
function GetJobNotes(ScheduleID) {
var par = "ScheduleID='" + ScheduleID + "'";
$.ajax({
type: "Post",
url: "MaskingScheduleService.asmx/HelloWorld",
//data: par,
dataType: "xml",
//success: GetInfoSuccess,
//error: ProcessError
});
alert("ajax called");
}
and here is what shows up in the [dynamic] version of the file when debugging:
function GetJobNotes(ScheduleID) {
var par = "ScheduleID='" + ScheduleID + "'";
$.ajax({
type: "Post",
url: "services/MaskingSchedule.asmx/GetJobNotes",
data: par,
dataType: "xml",
success: GetInfoSuccess,
error: ProcessError
});
}
How do I get the [dynamic] version to match the code in my javascript file?
The issue is that there is an option in Chrome that breaks the updated js file. With that option, Chrome will block the changed js content and always use the previous js content.
Solution
When starting vs debugging under Chrome, please press F12 and then select Network menu.
This is an option called Disable cache
Check this option and then refresh your web page and it will load the latest version of the javascript file.

Why the code is not reached?

I have 2 webpages where the code works on one page but on the other page it won't work. The code is supposed to open a new window with the submitted file to display the submitted file. For some reason it won't do it on the page that fails.
The code that is taken from moodle is:
function openDV(dvtype, submission_id, coursemoduleid) {
alert('i opendv');
$.ajax({
type: "POST",
url: "../../plagiarism/turnitin/ajax.php",
dataType: "html",
data: {action: dvtype, submission: submission_id, cmid: coursemoduleid},
success: function(data) {
alert('i success');
$("."+dvtype+"_form_"+submission_id).html(data);
alert('i success 2: '+"."+dvtype+"_form_"+submission_id);
$("."+dvtype+"_form_"+submission_id).children("form").on("submit", function(event) {
alert('debug 2');
dvWindow = window.open('', 'dv_'+submission_id);
dvWindow.document.write('<frameset><frame id="dvWindow" name="dvWindow"></frame></frameset>');
dvWindow.document.close();
$(dvWindow).bind('beforeunload', function() {
refreshScores(submission_id, coursemoduleid);
});
});
alert('i success 3');
$("."+dvtype+"_form_"+submission_id).children("form").submit();
$("."+dvtype+"_form_"+submission_id).html("");
},
error: function() {
alert('error!');
}
});
}
On the failing page, the code that is alert('debug 2'); is not reached. Why?
It's not part of the Moodle core code, so I'm guessing its a download of this plugin?
https://moodle.org/plugins/view/plagiarism_turnitin
There are 2 versions though, the old one is at https://github.com/danmarsden/moodle-plagiarism_turnitin
The latest one is at https://github.com/jmcgettrick/moodle-plagiarism_turnitin
I had a very quick look and couldn't see the ajax code.
Where did you download the code from? Also what version of Moodle are you using? Maybe check you are using the latest version of the plugin for your version of Moodle.
UPDATE: The Moodle page above says that the turnitin module needs to be installed too. Is this installed on the destination server?
https://moodle.org/plugins/view/mod_turnitintooltwo
UPDATE 2: Ah yes, the ajax code is in turnitintooltwo
https://github.com/jmcgettrick/moodle-mod_turnitintooltwo/blob/master/jquery/turnitintooltwo.js
It looks like the code your are using is out of date.

jquery post in mobile browser doesn't work

I'm trying to make a post request with jQuery in a web application with the following code :
alert('1');
$.post(server_hostname,
{ method: 'getTimestamp', type: 'text', partnerKey: partnerKey },
function(results, textStatus) {
alert(results)
alert('2');
},
'text');
That's working very well in chrome and firefox on my computer but not in safari for iOS nor in the Android browser. I guess $.post() doesn't success in a mobile browser but why?
On the other hand, how can I see the javascript errors output with my iPhone/Android ?
Thanks!
you datatype 'text' should be xml, json, script, or html
for more information see jQuery's post documentation

Internet Explorer JavaScript - newline characters crashing script

I have a onclick event in JavaScript that I have chosen to format as below:
<a href="" onclick = "
$('.white_content').html('<img src=\'/making.gif\'>');
$.ajax({
url: '/show_album.php?id=<?=$album['id']?>',
type: 'GET',
success: function(data){
$('.white_content').html(data);
},
error: function(){
alert('failed');
}
});
return false;">
In FireFox, this is fine, but in Internet Explorer 8 the script is crashing because of the way I have layed out the code in new lines instead the onclick attribute.
Does anyone know a good way to fix this? I am still developing this page and others using similar code and I would like to keep a clean layout as opposed to all on one line.
If I inspect the onclick attribute in Internet Explorer developer tools I find each line seperated by several strange boxes that I assume represent unknown characters, obviously in IE, this is causing the error.
do the following instead:
<script>
function myOnclick() {
$('.white_content').html('<img src=\'/making.gif\'>');
$.ajax({
url: '/show_album.php?id=<?=$album['id']?>',
type: 'GET',
success: function(data){
$('.white_content').html(data);
},
error: function(){
alert('failed');
}
});
return false;
}
</script>
<a href="" onclick="return myOnclick();">

'Permission Denied' when trying to make Jquery $.ajax request

function populateGroups(){
var p =1;
var groupNames = new Array();
$.ajax({
type: "GET",
url: "http://okcmonprd103/iMon/findgroups.pl",
dataType: "text/xml",
success: function parseGroupNames(xml){
$(xml).find('group').each(function(){
groupNames[p] = $(this).find('name').text();
p++;
});
groupNames.sort(arraySort);
for(p=0;p<groupNames.length-1;p++){
$('#Groups').append('<option value="'+p+1+'">'+groupNames[p]+'</option>');
$('#dutyGroups').append('<option value="'+p+'">'+groupNames[p]+'</option>');
}
}
});
}
I send this ajax call to a server on our network that runs a Perl script that returns XML data. This works fine on my machine in IE8, and in my Windows 7 Gadget (which is what this is mainly for) but whenever other people in the company try to use it, they get the "Permission Denied" error. Do I need to set up a proxy page in order to make this work?
It does work on my machine, I just don't see how other people on the same network wouldn't be able to use this...
It turned out that it was a Windows 7 issue. When you right clicked on the HTML file name, under security, it would say something like "this file is blocked because it came from another computer"
All you had to do was press the "Unblock" button and all of a sudden it worked.

Categories

Resources