Probably something stupid --- (the coder?)
This has been giving me fits all afternoon. I'm loading a page with this in it:
<script type="text/javascript">// <![CDATA[
thisnamed = DK.thisname;
$('#company_location').val($('#company_location').val().replace(/\s/g,"+")).autocomplete({
url: "//www.work.com/white/data_server.php?name="+thisnamed+"&f=addr",
minChars:2,
maxItemsToShow:10,
useCache:false
//open: function(event, ui) { disable=true },
//close: function(event, ui) { disable=false; $(this).focus(); }
});
// ]]>
</script>
Of course, it's not "work.com". jQuery and autocomplete are loaded and doing their thing elsewhere on the page.
DK is an object. Debugger doesn't show errors or anything like that.
The issue seems to be that although I can get the correct value for DK.thisname in the console, the Net panel shows $.ajax asking for its url without the name variable in the GET string:
Firebug wrote:GET http://www.work.com/white/data_server.php?name=&f=addr&q=123
And ... it doesn't seem to matter if I do this:
DK.thisname = document.getElementById('element_name').value;
Or even this:
$('#company_location').val($('#company_location').val().replace(/\s/g,"+")).autocomplete({
url: "//www.work.com/white/data_server.php?name="+document.getElementById('element_name').value+"&f=addr",
minChars:2,
maxItemsToShow:10,
useCache:false
});
Or just use "DK.thisname" in there ... doesn't seem to matter.
I can't tell if it's some sort of scoping issue, or a DOM event/firing/timing issue ... I'm thinking it should be working.
Can anyone give some light on this one?
Thank you ... 🙂