Embed Facebook post with Angular [duplicate] - javascript

This question already has answers here:
facebook social plug-in not showing up when added dynamically
(2 answers)
Closed 7 years ago.
I am working around a Facebook sdk and angularJS.
I have a trouble about how to dynamic loading Facebook Embed post in Angular Template.
after request Ajax success it doesn't show anything
<div class="fb-post" data-href="{{EmbedPostUrl}}" data-width="500"></div>
Any idea ?

The Problem could be that the Expression in data-href will be resolved immediately to {{EmbedPostUrl}} which will trigger an 404 Error.
Try to write a custom directive which will create the data-href attribut if the passed value is not false.
If that doesnt works, try to load the facebook sdk asynchronous after the ajax call was done.
And if you need to change the url sometimes, try to create the whole element by yourself wit a custom directive.

Related

Can get requests placed by <a> tags include data? [duplicate]

This question already has answers here:
Sending PHP GET data to server using Html links
(2 answers)
Closed 4 years ago.
I know that requests placed by jQuery $.get() can include an optional parameter for additional data. I was wondering if there was any way to pass that information through requests that come about by clicking an link, or relocation the windows location.
Yes, you can use a Query String.
Excerpt:
Typical URL containing a query string is as follows:
http://example.com/over/there?name=ferret
When a server receives a request for such a page, it may run a program, passing the query string, which in this case is, name=ferret unchanged, to the program. The question mark is used as a separator, and is not part of the query string.
So your anchor could be:
My Link
or
My Link
or
My Link
Be aware that you can get caching issues by links/get requests.
The only way to pass data through a link as the page is visited is to use URL Parameters/Query Strings.

Vue sending email [duplicate]

This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 4 years ago.
I have a problem. I want to put a contact form on the page, but I do not know how to do it in the Vue. I wanted to do it normally as jquery, php, but it does not work in Vue. Does anyone have an idea what I can do?
Vue is a View (hence the name) library, meant for describing your View layer i.e. how your application looks. Such logic as sending an email would for one be dependent on Javascript itself and not on Vue.
However it is not possible to send an email from Javascript in the browser. Instead you'd need to build a backend which can send an email for you, or you could call the user's email client, both described here.
You would ideally send email data (to, message body - html escaped of course) as a request to a backend end point and send from there. You can use Vue's HTTP resource to send the request: https://github.com/pagekit/vue-resource
But sending an email directly from Vue isn't possible.

Document.write() is giving back "Uncaught TypeError: Cannot read property 'document' of null"" [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am using Angular2 for the front end on a website. It will be iframed into another website. when using the HTTP post method i receive the response which is json
This is the API Post method. it will return a json result
in the front end sending of the post request i take the response and put it into json. then i set a variable in my AppService class with a set method. then in the completion of the HTTP request i open a new tab and fill it with the HTML. using the document.write() is where i get the error
This is the front end Post request
the 2 options i thought of to solve this were sending a window.postmessage() to the parent of the iFrame to try and open the new tab. Or make another iFrame inside of the current however both of these are non-optimal.
It's entirely possible that a pop-up window gets blocked by the browser. If that happens, window.open() returns null and you need to write your script to handle this situation.
Most modern browsers are pretty "clever" about blocking pop-up windows, meaning they only allow a script to open one as a direct consequence of a user interaction. Because of this, running window.open() on the completion of an AJAX request is very likely to fail. One way to solve this is to open the window immediately when the user has initiated the action, then perform the AJAX request and write to the window when it's successful. Something like this:
button.onClick = function() {
var popUp = window.open();
if (popUp) {
doAjaxRequest().then(function(data) {
popUp.document.write(data);
popUp.document.close();
});
}
}

How to check data transfered via ajax? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Making a hack proof game in Javascript
I'm building a very simple web game
In this game when player clearing all missions the total score should be posted to server .
question is : ajax params could be modified easily .
How to check if datas modified ?
There are several diferent solutions.
You can check you server script that processing your AJAX data, and then logged them.
Another way is to use your browser console. The most of the new Web Browsers are having console, that allowing you to check all the data of your web page, even the data you send or receive from the server with AJAX Calls.

checking the page exist or not using javascript and ajax [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How to check if a page is exist or not using javascript
can you provide the code for checking the page exist or not.if not,it will redirect to another page.
The problem is, if the page doesn't exist (the server is given what it considers an invalid url that it cannot satisfy), you will get a 404 error. So no code on any target page is going to run. Instead you have to do this server side, specifying what page to serve instead when a 404 is encountered. It is not done with client-side javascript.

Categories

Resources