As this is my first contact with ajax I need some help.
There are 2 tables and 2 php scripts. User inserts into first table lets say 10 000 - 20 000 recordsets, and later second script handles those recordsets, and if handling was successful - it transfers to second table, and deletes from first table.
This is what I need to accomplish
Now I have implemented ajax using prototype bat there are some problems described below.
First script (executable) is working ok (inserting recordsets into first table), and after first script is done there is started second script - witch is not executed every time. I have noticed that when number of data posted from form to first script is big (10 000) - second script doesn't start, but if there is only submitted a few (<=20) then everything is working fine.
here is javascript code
Code: Select all
<script src="../prototype/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function init () {
$('Submit').onclick = function () {
sendData();
sendData1();
}
}
function sendData () {
var url = 'firstScript.php';
var pars = Form.serialize('myForm');
var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onLoading: showLoad, onComplete: showResponse} );
}
function sendData1 () {
var url = 'secondScript.php';
var pars = Form.serialize('myForm');
var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars} );
}
function showLoad () {
$('load').style.display = 'block';
}
function showResponse (originalRequest) {
var newData = originalRequest.responseText;
$('load').style.display = 'none';
$('status').innerHTML = newData;
}
</script>
There is nothing wrong with php scripts (tested)
If somebody can help me I would appreciate it
Thank you
Kind regards