Thursday, June 23, 2022
HomeWordPress DevelopmentShip Array from JS to php file then insert it in wp...

Ship Array from JS to php file then insert it in wp database via a plugin


This’s my code it is success however when however I am unable to the return information from ajax in the identical web page.
the mechanism is the consumer click on the dropbox button and when he selects it returns dropbox_links after which insert dropbox_links in database utilizing add_post_meta

The Insert must be on the spot becuase the dropbox button click on is the one set off

 $.ajax({
    
                kind: "POST",
                information: {
                    req: JSON.stringify(dropbox_links)
                },
    
                cache: false,
                success: perform(responseData) {
                    // think about using console.log for these form of issues.
                    console.log("Knowledge recived: " + responseData);
                    console.log(dropbox_links);
    
                },
                error: perform(msg) {
                    console.log("unsure what to ask for right here to test subject" + msg);
                }
            });

This’s the php code however I do not catch or print any information so ought to I re-run the entire php script to see if it returns any information?

perform printdata()
{
    $information    = $_POST["req"];
    $information    = json_decode($information, true);
    print_r($information);
}

if (isset($POST["req"])) {

    printdata();
} else {;
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments