dynamic chaining sweetalert2 - dynamic

I want to chained alerts via json. I have this:
[
{"mes":"there are <strong>3<\/strong> messages.", "ico":"info"},
{"mes":"message1","ico":"error"},
{"mes":"message2","ico":"success"}
{"mes":"message3","ico":"warning"}
]
I want to generate 4 alerts for this json one after another. I tried with jquery.each but no success.
Please help.

that was ridiculously easy.
i sent data from php like this:
echo json_encode([
{"mes":"there are <strong>3<\/strong> messages.", "ico":"info"},
{"mes":"message1","ico":"error"},
{"mes":"message2","ico":"success"}
{"mes":"message3","ico":"warning"}
]);
and parse like this:
swal.queue(JSON.parse(data);
so i achieved what i want.

Related

Laravel -6 Email with Raw Data

Using Email Body and Attachment at a time
My Code is:
Mail::send( [],array(), function ($message) use ($fromName,$fromEmail,$receiptEmailSubject,$receiptEmailData,$emilId,$pdf){
$message->to($emilId)
->from($fromEmail,$fromName)
->subject($receiptEmailSubject)
->setBody($receiptEmailData, 'text/html')
->attachData($pdf->output(), 'receipt.pdf',['mime' => 'application/pdf']);
});
But unable to use "setBody" and "attachData" as like. (If removed any one email sending works Properly. Need to remove "setBody" OR "attachData")
How to use "setBody" and "attachData" together ?
You can't use setBody and attachData together in Laravel

How to query between floating dates?

I am querying from this dataset. From the documentation I know there is a variable disp_date (floating_timestamp). From the documentation I think I should be able to use the between ... and ... on disp_date.
Suppose I want from 2016-01-01 to 2016-02-31. I tried the following:
https://data.brla.gov/resource/4w4d-4es6.json?disp_date between 2016-01-01T00:00:00.000 and 2016-02-01T00:00:00.000
{
"error" : true,
"message" : "Unrecognized arguments [disp_date between 2016-01-01T00:00:00.000 and 2016-02-01T00:00:00.000]"
}
It looks like you're missing $where statement at the beginning. Also, need some quotes around the dates. This worked for me:
https://data.brla.gov/resource/4w4d-4es6.json?$where=disp_date between '2016-01-01T00:00:00.000' and '2016-02-01T00:00:00.000'
With HTML encoding:
https://data.brla.gov/resource/4w4d-4es6.json?$where=disp_date%20between%20%272016-01-01T00:00:00.000%27%20and%20%272016-02-01T00:00:00.000%27

Pouchdb Find Plugin - How to use this plugin with similar to SQL LIKE %abc%?

I encounter problem to use Pouchdb Find Plugin to do something like SQL LIKE %abc% and with sorting.
May I know is there any possible way that can use like that?
var selector = {
selector: {
'name': {$like: 'David'},
'age': {$gt: 0}
},
sort: [{'age': 'asc'}]
}
You can use the $regex matcher, and then have a regular expression like '.*?abc.*?'.
Keep in mind, though, that this query is very inefficient because it's not indexed; it's run in-memory. (The same is true of relational databases like MySQL/Postgres.) In general, you should only do prefix searches, not searches that look inside of the string, because then you need to scan the entire database to do so.

using req.params to work with an array is failing

var myArray = [1,2,3,4];
If I post to 'api/myArray' and I want to retrieve these values, the following does not work:
'api/:var'
field : {blah: req.params.var[0], blah2: req.params.var[1]}
This does not work, and after console I realized it is no longer an array. Instead, var is now 1,2,3,4 instead of [1,2,3,4]. How do I solve this?
My excuses. I should really have tried harder to find out how to do this.
req.params.var.split(',') would do this
1st:
while sending you can serialize it
JSON.stringify(var)
and recieve it as
JSON.parse(var)
2nd:
Post with formdata instead
you can use req.body instead of params
then you can access like
req.body.var[0]

Ravendb Multi Get with index

I am trying to use ravendb (build 960) multi get to get the results of several queries.
I am posting to /multi_get with:
[
{"Url":"/databases/myDb/indexes/composers?query=title:beethoven&fetch=title&fetch=biography"},
{"Url":"/databases/myDb/indexes/products?query=title:beethoven&fetch=title&fetch=price"}
]
The server responds with results for each query, however it responds with EVERY document for each index. It looks like neither the query is used, or the fetch parameters.
Is there something I am doing wrong here?
Multi GET assumes all the urls are local to the current database, you can specify urls starting with /datbases/foo
You specify that in the multi get url.
Change you code to generate:
[
{"Url":"/indexes/composers?query=title:beethoven&fetch=title&fetch=biography"},
{"Url":"/indexes/products?query=title:beethoven&fetch=title&fetch=price"}
]
And make sure that you multi get goes to
/databases/mydb/multi_get