Sweet Alert works in local but Doesn't work in server - sweetalert

That function works in local host(I am using Laragon) but in the host(Natro) doesn't work. I didn't understandt how is it possible.
$.ajax({
url:"netting/process.php",
type:"POST",
data:new FormData(this),
contentType:false,
cache:false,
processData:false,
success:function(data){
veri=JSON.parse(data);
if (veri.status=="success") {
swal(veri.head,veri.message,veri.status);
}
else{
swal(veri.head,veri.message,veri.status);
}
}
});

i also have this problem right now. it work fine in local but gave me error on my hosting.
EDIT: try to use sweetalert2 script bro
i just figured it out by updating my script's src with this https://cdn.jsdelivr.net/npm/sweetalert2#7.26.9/dist/sweetalert2.all.min.js
hope it work

Related

<video> tag. DOMException: The element has no supported sources, when not utilizing require()

I am trying to play a video when developing locally with VueJS 2.
My code is the following :
<video class="back_video" :src="`../videos/Space${videoIndex}.mp4`" id="background-video"></video>
...
data :
function() {
return {
videoIndex:1
}
}
...
const vid = document.getElementById("background-video");
vid.crossOrigin = 'anonymous';
let playPromise = vid.play();
if (playPromise !== undefined) {
playPromise.then(function() {
console.log("video playing");
}).catch(function(error) {
console.error(error);
});
}
This code is causing the exception given in title. Tried in several browsers, always the same.
If I change the src by :
:src="require(`../videos/Space${videoIndex}.mp4`)"
it works.
But in that case building time is very long as I have many different videos in my videos directory, because adding require() will force to copy all videos in the running directory at build phase (vue-cli serve), and this is really annoying. In other words I want to refer videos that are outside the build directory to avoid this (but also to avoid having videos in my git).
It is interesting to note that when I deploy server side, it works perfectly with my original code
:src="`../videos/Space${videoIndex}.mp4`"
Note also that if i replace my code with simply
src="../videos/Space1.mp4"
it works too. So the video itself, or its location, are not the source of the problem.
Any clue ?
You can host your videos on a CDN to have something faster and easier to debug/work with.
Otherwise, it will need to bundle it locally and may take some time.

Application.Current.MainPage.DisplayActionSheet causing issue in xamarin.forms IOS

Hello i have implemented camera functionality in my app using media.plugin
but camera does not open in ios.
if (string.IsNullOrEmpty(StorageFolder))
{
StorageFolder = await Application.Current.MainPage.DisplayActionSheet(SystemMessages.PhotoSaveFolder, "Cancel",
null, "folder1", "folder2");
}
await CrossMedia.Current.Initialize();
MediaFile file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
});
it is because of DisplayActionSheet() which i use for folder option selection.if i remove that code it works fine.then what is issue with it.cant figure out.
it dont throw any error but thread exit after some time and in debugging i am unable to trace what exactly going on.
please help.stuck with this.
Thank you in advance.
oh..that's the issue of xamarin version. i upgraded xamarin.forms from 2.3.0.107 to 2.3.4.247.that was causing issue.
revert back this changes solved my issue and working well as before.

Sending Additional Info with a Typeahead Query

I'm using Bootstrap 3.2.0 and jQuery 2.1.1.
I've implemented typeahead search suggestions and now wanted to go a step further. I am using the remote method and was hoping to send more than just the query to the PHP that will run a SQL script:
$(function() {
var productEngine = new Bloodhound({
datumTokenizer: function (datum) { return Bloodhound.tokenizers.whitespace(datum.value); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
remote: { url: 'php/product_suggest.php?storeid='.concat(localStorage.getItem('store_id'), '&query=%QUERY') }
});
productEngine.initialize();
$('input#product_suggest').typeahead(null, {
displayKey: 'value',
source: productEngine.ttAdapter()
});
});
I've also tried building the URL and saving as a variable. Then attempting to call that variable in the remote.
remote: { url: builtURL }
As I don't particularly know how this url is being parsed and used or how the %QUERY is being added, I'm assuming my issue lies in my lack of knowledge around how typeahead is processing this.
I thought this would be a fairly common request, but Google has let me down. Anyone have any suggestions or can point me towards examples of sending additional info with a typeahead query?

Navigating site (including forms) with PhantomJS

I'm trying to automate an application that uses form security in order to upload a file and then scrape data from the returned HTML.
I started out using the solution from this question. I can define my steps and get through the entire workflow as long as the last step is rendering the page.
Here are the two steps that are the meat of my script:
function() {
page.open("https://remotesite.com/do/something", function(status) {
if ('success' === status) {
page.uploadFile('input[name=file]', 'x.csv');
page.evaluate(function() {
// assignButton is used to associate modules with an account
document.getElementById("assignButton").click();
});
}
});
},
function() {
page.render('upload-results.png');
page.evaluate(function() {
var results = document.getElementById("moduleProcessingReport");
console.log("results: " + results);
});
},
When I run the script, I see that the output render is correct. However, the evaluate part isn't working. I can confirm that my DOM selection is correct by running it in the Javascript console while on the remote site.
I have seen other questions, but they revolve around using setTimeout. Unfortunately, the step strategy from the original approach already has a timeout.
UPDATE
I tried a slightly different approach, using this post and got similar results. I believe that document uses an older PhantomJS API, so I used the 'onLoadFinished' event to drive between steps.
i recomend you use casperjs or if you use PJS's webPage.injectScript() you could load up jquery and then your own script to do form input/navigation.

Simple Web Audio API example plays in JsFiddle but not locally

I have found a simple example of the web audio API in action here:
http://jsfiddle.net/stuartmemo/xMruN/
When I run it in JsFiddle it works perfect (in Chrome) but when I copy the code locally it doesn't work. Here is the code I've used locally:
<!DOCTYPE html >
<meta charset="UTF-8">
<title>Test</title>
<script type="text/javascript">
var context = new webkitAudioContext(),
oscillator = context.createOscillator();
oscillator.type = 3;
oscillator.frequency.value = 500;
oscillator.connect(context.destination);
oscillator.noteOn(0);​
</script>
I feel like this has a simple solution I'm overlooking but I've been at it for 20 minutes.
BTW I'm running my local example on a web server (even though I doubt I should have to).
Thanks
You should wait for window to load like so:
window.addEventListener('load', function () {
var context, oscillator;
try {
context = new webkitAudioContext();
} catch (e) {
alert("Your browser does not support Web Audio API");
}
oscillator = context.createOscillator();
oscillator.type = 3;
oscillator.frequency.value = 500;
oscillator.connect(context.destination);
oscillator.noteOn(0); // play it immediately
oscillator.noteOff(1); // turn it off after 1 second from now
});
Removed this line and it works.
oscillator.noteOn(0);​
Removed this line and it works.
oscillator.noteOn(0);​
The noteOn method is deprecated in the Web Audio API. You can change that line to:
oscillator.start(0);
… and it should work as originally intended.
BTW I'm running my local example on a web server (even though
I doubt I should have to).
Actually, some of the Web Audio API stuff won’t work unless you run it from a server. So you are doing the right thing by running a local server.
Oscillator types are no longer specified with integers. Use strings instead, e.g.
oscillator.type = 'sawtooth';
I don't know if that is what's causing your problem here. Perhaps JsFiddle used an older implementation of the web audio api?