2

I have this problem: I have this JavaScript code in a Dynamic Action:

var vMe     = $(this.triggeringElement);
var vRow    = $(vMe).parents(".meAllRow");
var vSeqID  = $(vRow).find("[headers=SEQ_ID]").html();
var vEstado = $(vRow).find("[name=f01]").val();

apex.server.process("ajx_Cambia_estado",{x01:vSeqID,x02:vEstado});

and this is the PL-SQL CODE

DECLARE

vEstado VARCHAR2(1);
vSeq    NUMBER := to_number(APEX_APPLICATION.g_x01);
BEGIN   
        IF (APEX_APPLICATION.g_x02 = 'A') THEN
            vEstado := 'I';
        ELSE
            vEstado := 'A';
        END IF;

        APEX_COLLECTION.UPDATE_MEMBER (
        p_collection_name => 'DINAMIC_LIST',
        p_seq  => vSeq,
        p_c002 => vEstado);   

END;

When I execute the dynamic action, it throws this error:

SyntaxError: Unexpected end of JSON

but when I put a return in the PL-SQL like:

htp.p('"process":"finish"');

the error disappears. But I don't need to send a response message, in Apex 4.2 I don't have this problem.

1 Answer 1

2

Try:

DECLARE

vEstado VARCHAR2(1);
vSeq    NUMBER := to_number(APEX_APPLICATION.g_x01);

BEGIN   
        IF (APEX_APPLICATION.g_x02 = 'A') THEN
            vEstado := 'I';
        ELSE
            vEstado := 'A';
        END IF;

        APEX_COLLECTION.UPDATE_MEMBER (
        p_collection_name => 'DINAMIC_LIST',
        p_seq  => vSeq,
        p_c002 => vEstado);   

        apex_json.open_object;  
        apex_json.write('success', true);  
        apex_json.close_object; 

END;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.