Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
in asp.net web application i have js script to post data on Sendy. My code:
JavaScript
<script type="text/javascript">
    function sendy(nameS, emailS, listID, listUrl) {
        $.ajax({
            type: "POST",
            url: listUrl,
            data: {
                email: emailS,
                list: listID,
                name: nameS
            }
        });
    }
</script>


This code dont work. If I add alert at the and, it starts to work. Code with alert:
JavaScript
<script type="text/javascript">
    function sendy(nameS, emailS, listID, listUrl) {
        $.ajax({
            type: "POST",
            url: listUrl,
            data: {
                email: emailS,
                list: listID,
                name: nameS
            }
        });
        alert("1");
    }
</script>


What can I do to make it work and I dont need alert? Can I close the alert popup automatically,
before user see the window?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 12-Sep-14 20:53pm    
This effect of adding alert looks so weird that I would ask you: what do you mean by "don't work", exactly? Maybe it works exactly as well but you simply fail to observe it?
—SA
vezo11 13-Sep-14 6:11am    
If i add alert, then this method post mail on sendy, but if i not add then dont add. I try with reload (refresh site), add another function (sleep and my own popup alert) and call them....
Sreekanth Mothukuru 13-Sep-14 8:00am    
Check for jQuery ajax callbacks at http://api.jquery.com/jquery.ajax/
DiponRoy 22-Sep-14 16:33pm    
can you just show the server end method/code(web service/service/WebApi/action) where you trying to post such?

No need to have an alert. Since it is an Ajax call you need to rely on callbacks (done, fail and always) as shown in below sample:

JavaScript
// Assign handlers immediately after making the request,
// and remember the jqXHR object for this request

var jqxhr = $.ajax( "example.php" )
  .done(function() {
    alert( "success" );
  })
  .fail(function() {
    alert( "error" );
  })
  .always(function() {
    alert( "complete" );
  });
 
Share this answer
 
Comments
vezo11 13-Sep-14 10:32am    
I never used ajax so i dont know how it works. I try some combinations, but none works. I looked at a few examples, may be I will be successful. Thanks
[^]Why Promotional Items make a splash On Buyers

The reality of the issue is the fact that promotions may have an extremely enormous effect on customers and prospective buyers. There are certain attributes that creative and powerful promotional marketing campaigns can deliver that other kinds of advertising only cannot rival.

Promotional Products Association International, an American-based industry organisation, points to a handful of proven truth about promotional items that demonstrate just how smart of an investment the right unconditional love quotes are. What sets a decent campaign apart is its physical nature.

A few of the aspects that make using promotional advertising a good thought include:

* The ability to drive traffic -- When firms put in place at community events, tradeshows and other high-traffic assemblies, the tables offering promotional giveaways are usually the most trafficked. This is especially so if promotions are creative, unique, fun or useful.
* The ability to boost direct mail campaigns -- When direct words of love turned into welcomed entrances because of the inclusion of promotional giveaways, receivers tend to take notice. If the items capture attention, the probability of reaction speeds going up is definitely present.
* The power to improve incoming referrals -- When people enjoy a service or product, they often pass to the info to friends, families and coworkers. The right promotional materials can function as reminders to clients about those services and goods. Items like promotional t happy love quotes rings along with other promotions which have the ability to stick around for a while also can generate their own leads as wearable, portable ads. This is the reason logo t shirts and promotional caps are so popular.
* The ability to improve return business rates -- Promotional items that "stick around" can serve as really strong reminders to preceding customers to return when they want a particular product or service. Things like promotional calendars, magnets, quotes on love as well as other tools that may be hung on to for a while can pay off with repeat business down the road.
* The bent for raising worker morale -- Promotional polo shirts and also other similar things could work very well for improving employee morale and helping workers feel like portion of a team. As trivial as it sounds, little touches like these can go a long way in helping employees identify with their quotes love feel like an important part of a bigger picture.

Promotional items can possess an enormous effect on buyers simply because they are distinct. While radio, television and print adverts can work extremely well, promotions can take on a life of their very own. Unlike the one dimensional world that most advertisements live in, promotional efforts can speak to all the perceptions and have a staying power that extends well beyond a 30-second spot or a day in
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900