Ich begann JS und WebApi.Net zu lernen Mein Problem: Teil_2 durchgeführt vor Teil_1, aber manchmal funktioniert es richtig.Falsche konsistent von Ereignissen
//**** <part_1> ****
var link = 'api/Values',
ttMass = new Array(); //make ToolTip array
$(document).ready(function() {
$.get(link, {
i: 1
}, function(data) { //http-response as 'api/Values/1'
$.each(data, function(i, val) {
ttMass.push(val);
});
});
});
//**** </part_1> ****
//**** <part_2> ****
$(document).ready(function() { //
$.get(link, {
i: 0
}, function(data) { //http-response as 'api/Values/0'
$.each(data, function(i, val) {
$(sel).append('<option value="' + val + '" data-toggle="tooltip" data-placement="right" title="' + ttMass[i] + '">' + val + '</option>'); //fill <select> values and ToolTip
});
});
});
//**** </part_2> ****
Wie machen diese Teile konsequent?
Ihr letzter Code funktioniert. Vielen Dank. Aber über diesen Code. Ich verstehe nicht, wo Sie 'ttMass' füllen –
' $ .get (Link, {i: 1}, Funktion (ttMass) {'<- –
Danke. Jetzt weiß ich mehr. –