Using ajax: Problems running AJAX within a file loaded previously via AJAX on newest questions tagged ajax – Stack Overflow
I’ve been using this code
<script>
$(document).ready(function() {
$.ajaxSetup({ cache: false }); //stops it caching the values so form can be change and the result updated without need for refreshing the page
});
$(function() {
$('#select_user').live('submit', function(e) {
e.preventDefault(); // stops form from submitting naturally
$.ajax({
data: $(this).serialize(),
url: $(this).attr('action') , //gets the form url from the atribute 'action' on the form.
success: function(response) {
$('#result').html(response);
}
});
});
});
</script>
Too produce an ajax request and pass variables from a form to another file, which is working fine. The file that is outputted into the div ‘result’ has another form and I want this to pass to another div inside the file that is loaded into ‘result’. I was hoping to just copy the code changing the different form names and divs it is outputted but this never worked. Any ideas into how I may do this.
Tried to explain it best I could, I know its a little confusing!
Thanks!
source: http://stackoverflow.com/questions/11250223/problems-running-ajax-within-a-file-loaded-previously-via-ajax
Using ajax: using-ajax
Recent Comments