Page 1 of 1

ew.ajax (v2023)

Posted: Wed Feb 07, 2024 7:49 pm
by dheeksha2511

var currentUser = ew.ajax("<?php echo Encrypt("SELECT COUNT(*) FROM s_group_details WHERE GROUP_ID = 'GRP177' AND MEMBERSHIP_LEVEL = 10 AND MEMBER_ID = '{query_value}'"); ?>", currUserID);

This is the code, this is displaying undefined.


Re: ew.ajax (v2023)

Posted: Wed Feb 07, 2024 8:28 pm
by arbei

Your argument is wrong, you may read the examples of Ajax by API and Client Script.


Re: ew.ajax (v2023)

Posted: Tue Jun 25, 2024 1:51 pm
by dheeksha2511
var sasy_main_details = ew.ajax("<?php echo Encrypt("SELECT PROJECT_ID,SYSTEM_SUBSYSTEM_FG,RME_OR_ATE,FAI_APPLICABLE,WAIVER_REFERENCE FROM sasy_requests WHERE SASY_REFERENCE = '{query_value}'"); ?>", sasy_ref);
    		 var prjID = sasy_main_details[0];
    		var system_fg = sasy_main_details[1];
    		var rmeOrAte = sasy_main_details[2];
    		var faiApplicable = sasy_main_details[3];
    		var waiverRef = sasy_main_details[4]; 
    		 $("#x__PROJECTID").val(prjID);
    		$("#x_SYSTEM_FG").val(system_fg);
    		if (rmeOrAte == 'RME')
    			$("#x_RME_OR_ATE_0").prop("checked", true);
    		if (rmeOrAte == 'ATE')
    			$("#x_RME_OR_ATE_1").prop("checked", true);
    		if (faiApplicable == 'Yes')
    			$("#x_FAI_APPLICABLE_0").prop("checked", true);
    		if (faiApplicable == 'No')
    			$("#x_FAI_APPLICABLE_1").prop("checked", true);
    		$("#x_WAIVER_REFERENCE").val(waiverRef);

This is the code which was not working so i gave the query in Api action ,

$app->get('/sasy_main_details/{sasy_ref}', function ($request, $response, $args) {
        $sasy_ref = $args["sasy_ref"] ?? null; // Get the input value
        if ($sasy_ref !== null)
            $response = $response->write(ExecuteRow("SELECT PROJECT_ID,SYSTEM_SUBSYSTEM_FG,RME_OR_ATE,FAI_APPLICABLE,WAIVER_REFERENCE FROM sasy_requests WHERE SASY_REFERENCE = " . AdjustSql($sasy_ref))); // Output field value as string
        return $response; // Return  Psr\Http\Message\ResponseInterface object
    }); 

This is not working, but for other query which has single value it is working, how to make this work for multiple row


Re: ew.ajax (v2023)

Posted: Tue Jun 25, 2024 5:31 pm
by arbei

The first part of your code won't work because you tried to send an encrypted SQL and there is no URL to send to at all.
The second part of your code is an API action, it will not run itself, you need to call it yourself.