javascript - jQuery - Can't receive data -


i have problem, using jquery/ajax run form, send data external file, , update part of page. ran problem:

the external site works. prints out div id="content" when run site manually.

but when im trying receive data document through jquery, not return field.

it runs other code on external file fine, executes database calls in external file fine. there no data returned, when code executed, text of "testlog" div (text here) disappears, isn't replaced.

so can me why can't retrieve data external file?

first, here relevant part of file want import into:

<script> $(document).ready(function() {  $( "#moven" ).submit(function( event ) {    // stop form submitting    event.preventdefault();    var $form = $( );    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 relevant part of external file:

<div id="content"> part want imported. should filled in data external file,  trying retrieved other file. </div> 

i hope of can novice out :)

if content root, not able find element, need filter it.

change

var content = $("#content", data).html(); 

to

var content = $(data).filter("#content").html(); 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -