[jQuery] How get data objects from a php file called via ajax
I am new to javascript and jQuery programming so my problem might be
very simple to explain but please bare with me.
I want to make a selection in a list created by a php-file that is
called from another php-file using jQuery and ajax but it fails.
My example is very limited but shows the main problem.
The first php-file has abutton defined like this:
<input class="mini_browse" type="button" value="Browse test" />
I also have a div to show the result:
<div id="myresult">Show the result here</div>
The jQuery entry looks like this:
jQuery(document).ready(function($) {
$('.mini_browse').bind("click", function() {
$.ajax({
type: "get", url: "test-ajax.php", data: { action: 'test' },
error: function() {$("#myresult").html("Ajax error");},
success: function(html){ //so, if data is retrieved, store it in
html
$("#myresult").html(html);
}
}); //close jQuery.ajax
return false;
});
});
When I click the button I get a call to test-ajax.php as expected and
the output is displayed in the myresult div but not as expected.
The test-ajax.php executes this:
echo '<input class="test_select type="button" name="test_select_1"
id="test_select_1" value="Select" />';
The button is not displayed as a button but like an input text with
the text "Select" in it and I can not get a click event from it.
I can not see the output from test-ajax.php when I view the page
source so I guess that I have to get it included in the document
somehow but how?
Can anybody point me in the right direction to solve this?
Thanks!