I have a problem, where I am using jQuery/Ajax to run a form, send the data to an external file, and then update a part of my page. But I ran into a problem:
The external site works. It prints out this div with the id="content"
when I run the site manually.
But when im trying to receive this data from another document through jQuery, it will not return this field.
It runs all the other code on the external file just fine, as it executes the database calls in the external file just fine. But there is no data returned, as when the code is executed, the text of the "testlog" div (text here) just disappears, but isn't replaced.
So can you help me with why I can't retrieve the data from the external file?
First, here is the relevant part of the file I want to import into:
<script>
$(document).ready(function() {
$( "#moveN" ).submit(function( event ) {
// Stop form from submitting normally
event.preventDefault();
var $form = $( this );
term = $form.find( "input[name='direction']" ).val();
var posting = $.post( "/modules/world/movement/move.php", { direction: term } );
posting.done(function( data ) {
var content = $("#content", data).html();
$( "#testlog" ).html( content );
});
});
});
</script>
<div id="testlog">Text here<div>
And here the relevant part of the external file:
<div id="content">
Part i want imported. This should be filled in with data from this external file, but now we are just trying to get the retrieved by the other file.
</div>
I hope some of you can help a novice out :)