Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:41:09+00:00 2026-06-16T00:41:09+00:00

I am currently writing a chatbox plugin for WordPress. This plugin uses a jQuery.post()

  • 0

I am currently writing a chatbox plugin for WordPress.
This plugin uses a jQuery.post() method to send data to a php file in order to write the output to an html file, which in turn will be loaded to the chat window using jQuery.

Inside the php file I use to write the chat log to an html file I need to use WordPress API functions, but this php file is not included by WordPress, and therefore has no access to the WordPress API.

Is there a way to send this chat data to a php file that is included by WordPress so I can use the WordPress API? What would be the best way to tackle this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:41:09+00:00Added an answer on June 16, 2026 at 12:41 am

    You can use wp_localize_script for sending ajax url in a JavaScript object to the pages:

    function my_localized_vars() { 
        return array(
          'site_url' => get_bloginfo('url'), 
          'ajax_url' => admin_url('admin-ajax.php')
        );
    } 
    wp_localize_script('needle', 'object_name', my_localized_vars());
    

    Then you can add an action and handle the request.
    http://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_%28action%29

    And for getting the url using JavaScript you can code:

    var url = object_name.ajax_url;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing an interface to allow applications to send exception data to a
I am currently writing this manually using a line read from a file and
I'm currently writing a function what would create a zip file, which will be
I'm currently writing a passbook API that allows users to send push notifications to
I am currently writing code to transfer data to a remote vendor. The transfer
I am currently writing a plugin for a game where one feature includes the
Currently writing an app that should be able to quicklook webarchive. Copied data from
I am currently writing a Comet application which requires me to send chunks of
I am currently writing a plugin to a CAD style software. The plugin does
I am currently writing unit tests for a ViewModel in my project that uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.