When i select checkbox and click on "Show Status" button , its displaying Status value only after i refresh the page, but i need to show before refresh the page.
html
<td>
<input type="checkbox" id="assigneeid-<?php echo $orderrecords[$k][" tracking_id "]; ?>" onclick="assignorderids('<?php echo $orderrecords[$k][" tracking_id "]; ?>')" name="checkassigneeid" class="assigneeid-order" value="<?php echo $orderrecords[$k]["
tracking_id "]; ?>">
</td>
javascript
$('#show_status').click(function() {
var selected = [];
$('.assigneeid-order:checked').each(function() {
selected.push($(this).val());
$('.assigneeid-order').prop('checked', false);
});
var jsonString = JSON.stringify(selected);
$.ajax({
type: "POST",
url: "api.php",
data: {
data: jsonString
},
success: function(response) {
response = $.parseJSON(response);
$.each(response, function(index, val) {
$("#" + index + "").html(val);
});
}
});
});
api.php
$data = json_decode(stripslashes($_POST['data']));
$response = array();
foreach($data as $id) {
$orderid = $id;
$hide = '';
$post_data['username'] = 'admin';
$post_data['password'] = 'admin123';
$post_data['awb'] = $orderid;
$url = 'https://plapi.ecomexpress.in/track_me/api/mawbd/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, "http://plapi.ecomexpress.in/track_me/api/mawbd/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
$output = curl_exec($ch);
curl_close($ch);
$orderResults = $xml = simplexml_load_string($output);
foreach($orderResults - > object as $child) {
$status = (string) $child - > field[10];
break;
}
$res = explode("\n", $output);
if (!isset($res[13])) {
$res[13] = null;
}
$statusfinal = str_replace('<field type="CharField" name="status">', '', $status);
if ($statusfinal != '') {
$sqlecom = "UPDATE do_order set in_transit='".$status.
"',tconformed_by='Ecom' where tracking_id=".$orderid;
$db_handleecom = new DBController();
$resultecom = $db_handleecom - > executeUpdate($sqlecom);
}
// store the responce in array
$response[$orderid] = $status;
}
echo json_encode($response);
Please help me to find solution, i am using mysqli....
Please let me know if you have any doubts.... Thanks in Advance.
Update
Before i was getting status values based on orderid instead of awb , you can see in above image , that time status was showing before refreshing page. here is code for getting status based on Order ID....
$curl_data['username']='admin';
$curl_data['password']='admin123';
$data = json_decode(stripslashes($_POST['data']));
$response = array();
foreach($data as $id){
$orderid = $id;
$curl_data['awb']=$orderid;
$hide = '';
$url = 'https://plapi.ecomexpress.in/track_me/api/mawbd/?awb=awbnumber&order='.$orderid.'&username=admin&password=admin123';
$ch = curl_init();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close($ch);
$res = explode("\n",$output);
if ( ! isset($res[13]))
{
$res[13] = null;
}
$status = str_replace('</field>','',$res[13]);
$statusfinal = str_replace('<field type="CharField" name="status">','',$status);
if($statusfinal!='')
{
$sqlecom = "UPDATE do_order set in_transit='".$statusfinal."',tconformed_by='Ecom' where order_id=".$orderid;
$db_handleecom = new DBController();
$resultecom = $db_handleecom->executeUpdate($sqlecom);
}
// store the responce in array
$response[$orderid] = $statusfinal;
}
echo json_encode($response);
Update 2
below network tab , i got response properly as https://pastebin.com/VpWsngnV
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I've modified Josiah's answer from clone form element with increment which is working well for me however now I need to extend it a little further with the abiltiy to show and hide additional fields from inside a cloned div
i am working on a application front end with html, CSS java-script , all is fine but before loading image in header, icon icon appears first i want to add background color in place of broken image till original image is fully loaded
To be clear i will put the points below :