ew.ajax (v2023)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
dheeksha2511
User
Posts: 11

ew.ajax (v2023)

Post 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.


arbei
User
Posts: 9862

Post by arbei »

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


dheeksha2511
User
Posts: 11

Post 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


arbei
User
Posts: 9862

Post 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.


Post Reply