Closed MobsterGit closed 8 years ago
The change
event is firing on #products
because the contents of #products
changes. Thus this is expected behaviour.
You could check what is the value of #products
to see if you actually need to fire the request to /ajax/ajax_sort/
.
Thanks Tuupola,
I actually resolved the issue by changing .trigger to .on in the remote js file. Everything still loads, but allows me to have the option to activate the Ajax call after its populated.
Thanks much!
This is not an issue per say, but I'm using ajax .on('change') to load products after the second select is populated.
For some reason, when the second select #products populates, it's also firing my .on('change') function.
Is there a way to prevent this from happening in the .remoteChained function?
This:
` $(function() { // More code using $ as alias to jQuery /* For jquery.chained.remote.js */ $("#products").remoteChained({
});`
Also fires this:
`$('#products').on('change', function(event) { event.preventDefault(); var href = $(this).find('option:selected').attr('value'); console.log('href ' + href); location.hash = href; $('#sort').hide(); $('#sort').css({ display: 'block' }).animate({ height: '100%' }, function() {
` Thank you!