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 8605211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:46:13+00:00 2026-06-12T02:46:13+00:00

I’m trying to allow users to tweet a link from within my jQuery app.

  • 0

I’m trying to allow users to tweet a link from within my jQuery app. Basically, they create their own page, and then they select a number of social networks to share it on. On clicking ‘Share’, the app loops over the social network checkboxes, and posts to each, as selected.

I’m struggling to find a good way to do this for Twitter – everywhere I look online, I seem to get conflicting advice.

So, basically, what should happen is this:

  • The user selects the ‘Twitter’ checkbox in my app, and hits ‘share’.
  • The app should then generate a url behind the scenes, and create a Tweet for the user’s account.
  • The user can then be shown a verification box from Twitter, if necessary (presumably they’ll need to log in and verify the Tweet)
  • The Tweet gets added to their Twitter feed.

It doesn’t sound very complicated, but I can’t find a way of doing it!

Edit

Thanks to the responses below, I’ve now got the following code:

var serverUrl = 'https://twitter.com/intent/tweet?url="www.rocketreel.com"&text="Test"';

$.ajax({
  type: "GET",
  url: serverUrl,
  success: function(data) {
},

error: function(data) {
  var obj = jQuery.parseJSON(data);
  alert(obj.error);
  }
});

Now when I run it, I get (in the console):

XMLHttpRequest cannot load https://twitter.com/intent/tweet?url=%22www.mysite.com%22&text=%22Test%22. Origin null is not allowed by Access-Control-Allow-Origin.

I’m not able to run it from the actual site at the moment, so am using localhost – is that why I’m getting this?

  • 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-12T02:46:14+00:00Added an answer on June 12, 2026 at 2:46 am

    Have you tried reading the api documentation?

    https://dev.twitter.com/docs/tweet-button

    https://twitter.com/about/resources/buttons#tweet

    You can check the code of the tweet button and execute the code behind the tweet button. Pretty straight forward…

    Here is the url that’s being called:

    https://twitter.com/intent/tweet?original_referer=yoururl.com&source=tweetbutton&url=http://urltotweet.com&text=[text to tweet]
    

    UPDATE:

    You are running into a cross origin issue. You can’t load data from an other origin through ajax unless you use some workarounds (CORS, proxy,… since you can’t modify the twitter api, a proxy is your only option. But that too can come with it’s complications..) you probably don’t even need.

    Just open up a new window with the location… window.open(…) or create an iframe with the provided url in staid of loading a complete page through ajax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to understand how to use SyndicationItem to display feed which is
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

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.