Ich habe ein Formular, das mit der .load() -Methode geladen wird.Das Laden von Seitenfragmenten mit .load() schließt embedded Javascript aus
$(function() {
$('#items,#button-search').hide();
$("#companies").click(function() {
$(this).attr("value","");
$('#address,#new-company-form').empty();
});
$("#companies").autocomplete({
source: ";companies",
minLength: 2,
select: function(event, ui) {
if(ui.item.id == "create-new-company") {
// call the new company form
$('#address').empty();
$('#new-company-form').load(';company_form #autoform');
}
else
{
$('#new-company-form').empty();
$.ajax({
type: 'GET',
url: ';addresses?company=' + ui.item.id,
dataType: 'json',
// process the addresses
success: function(json) {
var opts = '';
$.each(json, function(k, v) {
opts += '<option>' + v + '</option>';
});
$('#address').html('<select>' + opts + '</select>');
}
}); //end ajax call to address
}
} // end select address
}); // end autocomplete
}); // end function
on line 15, ich habe
$('#new-company-form').load(';company_form #autoform');
wenn ich die #autoform JavaScript entfernen, die in den ist; company_form html funktioniert, sonst wird es nicht geladen.
Wie bekomme ich das zur Arbeit?
dank
Was ist mit den Semikolons? –
ist es Teil des Rahmens, den ich benutze. http://hforge.org/itools – khinester