in order to do a facebook invite automation i need to post specific data so that the facebook friend selection will open.
ill use this script on an already open event.
i think i just dont get the post() method, or it not used the way i want it.
im trying to run directly from the browser the method like this:
javascript:$.post('/events/create.php',{/ajax/choose/?type: 'event' eid: 'someeventid' send_invites_on_close: '1'});
or:
javascript:$.post('/events/create.php?eid=someeventid',{/ajax/choose/?type: 'event' eid: 'someeventid' send_invites_on_close: '1'});
any ideas?
thanks!
edit:
the html behind the post is:
<a class="mbs uiButton" role="button" href="/events/create.php?eid=*eventid*" rel="dialog-post" ajaxify="/ajax/choose/?type=event&eid=*eventid*&send_invites_on_close=1"><i class="mrs img sp_a2jb2c sx_c44d3d"></i><span class="uiButtonText">Select Guests to Invite</span></a>
The way of formatting parameters to JQuery post is like this (you were close, but need the commas to separate params) :
$.post("/events/create.php", { /ajax/choose/?type: 'event', eid: 'someeventid', send_invites_on_close: '1' });
(PS : not sure about whether your first param is legit without testing either - not sure about the special chars in there)
Related
I am currently using webflow to host my site. In the redirection section on the hosting tab. I added a 301 redirect query string that redirects to my index, I do this because I wanted to track where do the users come from in my site.
Read this article and try it out:
https://www.newmediacampaigns.com/blog/how-to-track-landing-page-redirects-using-google-analytics
So basically it states this:
old path: /mexico
new path: example.com/?key=mexico
So for example i created a redirect /mexico to go to my index with a query string. Currently it works really well, but i want to know if it is possible that the user does not see the query string when entering from a redirect link.
For example when user enters by example.com/mexico, the url search bar shows only example.com
I tried hiding it using javascript, but does not work.
var testURL = 'myurl';
testURL.split('?')[0];
Any clue? or suggestion?
The only way to do this is with the history API - not available in older browsers.
The standard way of doing this is
history.pushState("object or state to represent your page", "page title", "/thenewurlpath");
You could add this to your document.ready callback, E.G.
$(document).ready(function(){
history.pushState("something", "newtitle", "/thenewpath");
// Whatever else your document.ready callback is doing...
})
Hope this helped :)
if (oSession.HostnameIs("www.youtube.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
oSession.utilDecodeResponse();
oSession.utilReplaceInResponse("old string","new string");
}
Please tell me if I'm using the above script correctly or not.
Basically, How do I to replace/hide the word dolphin from the search query ? I don't want the client browser(my Google Chrome) to see it by any means.
Example : http://www.youtube.com/results?search_query=dolphin&page=3.
If this is not possible with Fiddler,then what other application do you recommend?
Thank you
You can replace anything in the url inside OnBeforeResponse, but doing so won't do anything useful, because the URL has already been sent to the server by then, so changing it that late has no visible impact to anything outside of Fiddler.
If you want to change the URL, do so inside OnBeforeRequest. In your FiddlerScript, look for the urlreplace handler to see how that works.
I have been searching for an answer for the last day-and-a-half; I can't believe Facebook's documentation is so sparse. I have the Facebook SDK initialising in my html. I have a div with an id="fb-root". On a button click I call the following in js:
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object:'https://developers.facebook.com/docs/dialogs/',
})
}, function(response){});
This produces a pop up window that says 'X likes an article on...' followed by the web app page title. Does anyone know how to customise THAT piece of text so it says 'X scored Y points on...'?
I can't seem to find info on the action_type options for the share_open_graph method. Any pointers are very welcome.
EDIT
Well, having found the list of action_types.
https://developers.facebook.com/docs/reference/opengraph
...I set up a custom action_type and associated object. How do I then set up the properties of my object? What are the properties we're supposed to use when we use the share_open_graph method? And WHY don't they tell us on developers.facebook?!
Facebook is telling me I need to publish my custom action to have it approved. The 'instructions' are here:
https://developers.facebook.com/docs/opengraph/using-actions/v2.0#publish
Does anyone fancy telling me what, exactly, that all means? How to I make an HTTP POST to a Graph API endpoint, for instance?
Suggest starting with the doc on custom stories:
https://developers.facebook.com/docs/opengraph/creating-custom-stories
You would need to create a custom action [ex: "scored"] / object [ex: "points"], connect them as a story, and customize from there.
I have built a calendar in php. It currently can be controlled by GET values from the URL. Now I want the calendar to be managed and displayed using AJAX instead. So that the page not need to be reloaded.
How do I do this best with AJAX? More specifically, I wonder how I do with all GET values? There are quite a few. The only solution I find out is that each link in the calendar must have an onclick-statement to a great many attributes (the GET attributes)? Feels like the wrong way.
Please help me.
Edit: How should this code be changed to work out?
$('a.cal_update').bind("click", function ()
{
event.preventDefault();
update_url = $(this).attr("href");
$.ajax({
type : "GET"
, dataType : 'json'
, url : update_url
, async : false
, success : function(data)
{
$('#calendar').html(data.html);
}
});
return false;
});
Keep the existing links and forms, build on things that work
You have existing views of the data. Keep the same data but add additional views that provide it in a clean data format (such as JSON) instead of a document format (like HTML). Add a query string parameter or HTTP header that you use to decide which view to return.
Use a library (such as YUI 3, jQuery, etc) to bind event handlers to your existing links and forms to override the normal activation functionality and replace it with an Ajax call to the alternative view.
Use pushState to keep your URLs bookmarkable.
You can return a JSON string from the server and handle it with Ajax on the client side.
I'm trying to make a field similar to the facebook share box where you can enter a url and it gives you data about the page, title, pictures, etc. I have set up a server side service to get the html from the page as a string and am trying to just get the page title. I tried this:
function getLinkData(link) {
link = '/Home/GetStringFromURL?url=' + link;
$.ajax({
url: link,
success: function (data) {
$('#result').html($(data).find('title').html());
$('#result').fadeIn('slow');
}
});
}
which doesn't work, however the following does:
$(data).appendTo('#result')
var title = $('#result').find('title').html();
$('#result').html(title);
$('#result').fadeIn('slow');
but I don't want to write all the HTML to the page as in some case it redirects and does all sorts of nasty things. Any ideas?
Thanks
Ben
Try using filter rather than find:
$('#result').html($(data).filter('title').html());
To do this with jQuery, .filter is what you need (as lonesomeday pointed out):
$("#result").text($(data).filter("title").text());
However do not insert the HTML of the foreign document into your page. This will leave your site open to XSS attacks.
As has been pointed out, this depends on the browser's innerHTML implementation, so it does not work consistently.
Even better is to do all the relevant HTML processing on the server. Sending only the relevant information to your JS will make the client code vastly simpler and faster. You can whitelist safe/desired tags/attributes without ever worrying about dangerous ish getting sent to your users. Processing the HTML on the server will not slow down your site. Your language already has excellent HTML parsers, why not use them?.
When you place an entire HTML document into a jQuery object, all but the content of the <body> gets stripped away.
If all you need is the content of the <title>, you could try a simple regex:
var title = /<title>([^<]+)<\/title>/.exec(dat)[ 1 ];
alert(title);
Or using .split():
var title = dat.split( '<title>' )[1].split( '</title>' )[0];
alert(title);
The alternative is to look for the title yourself. Fortunately, unlike most parse your own html questions, finding the title is very easy because it doesn;t allow any nested elements. Look in the string for something like <title>(.*)</title> and you should be set.
(yes yes yes I know never use regex on html, but this is an exceptionally simple case)