Property suggestion for data extension should try CORS first.  'suggest' key is optional in service manifest
@@ -100,34 +100,43 @@ ExtendReconciledDataPreviewDialog.getAllProperties = function(url, typeID, onDon
onDone([]);
} else {
var done = false;
- $.getJSON(
- url +"?type=" + typeID + "&callback=?",
- null,
- function(data) {
+ var onSuccess = function (data) {
if (done) return;
done = true;
-
var allProperties = [];
for (var i = 0; i < data.properties.length; i++) {
var property = data.properties[i];
var property2 = {
id: property.id,
- name: property.name
+ name: property.name,
};
allProperties.push(property2);
}
- allProperties.sort(function(a, b) { return a.name.localeCompare(b.name); });
+ allProperties.sort(function (a, b) {
+ return a.name.localeCompare(b.name);
+ });
onDone(allProperties);
- }
- );
+ };
- window.setTimeout(function() {
+ $.ajax(url + "?type=" + typeID, {
+ dataType: "json",
+ success: onSuccess,
+ timeout: 7000,
+ error: function () {
+ $.ajax(url + "?type=" + typeID, {
+ dataType: "jsonp",
+ success: onSuccess,
+ timeout: 7000,
+ error: function () {
if (done) return;
done = true;
onDone([]);
- }, 7000); // time to give up?
+ }
+ });
+ },
+ });
}
};
@@ -158,7 +167,7 @@ ExtendReconciledDataPreviewDialog.prototype._show = function(properties) {
renderSuggestedProperty(properties[i]);
}
- var suggestConfig = $.extend({}, this._serviceMetadata.suggest.property);
+ var suggestConfig = $.extend({}, this._serviceMetadata.suggest && this._serviceMetadata.suggest.property);
suggestConfig.key = null;
suggestConfig.query_param_name = "prefix";
