- Read all in AJAX Introduction.
- Read all in AJAX load().
- Trial 5: Let's use .load() to display a table sent from TRUQA.
(Note that the 'GET' method is assumed when there is no 2nd argument.
When the 2nd argument, i.e., query data, is an object, the 'POST' method is used.)
- Read all in AJAX get() and post().
- Trial 6: Let's use .post() to display a table sent from TRUQA.
After you complete the test, modify the code so that the GET method can be used.
- Read all in jQuery ajax() Method.
$.ajax({url:..., type:..., data:..., success: function(data) { ... }})
- Trial 6.5: Let's use .ajax() to display a table sent from TRUQA.
- How to update '#result-pane' in MainPage of TRUQA, using load()?
var command = {
page: 'MainPage',
command: 'SearchQuestions',
term: search_terms
};
$('#button-search-questions').click(function() {
var search_terms = ...;
$('#result-pane').load('controller.php', command); // when the second arg is object, POST is used. Otherwise, GET is used.
});
- How to update '#result-pane' in MainPage of TRUQA, using POST?
$('#button-search-questions').click(function() {
var search_terms = ...;
$.post('controller.php',
{
????
},
function(result) {
????
}
);
});
- How to update '#result-pane' in MainPage of TRUQA, using ajax()?
$('#button-search-questions').click(function() {
var search_terms = ...;
$.ajax({
url: 'controller.php',
type: 'POST',
data: {
????
},
success: function(result) {
????
}
});
});
- Can we send a form using jQuery AJAX?
- FormData can be sent with
$.ajax()
.
For example, $.ajax({..., data: new FormData(formDomObject), processData: false, ...});
.
- Trial 7: Let's to send a form for the 'ListQuestions' command to TRUQA controller, using the jQuery ajax() method.