Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

93
Views
A simple example of POST using javascript and ajax

I am debugging this function in javascript which refuses to run

<script type = "text/javascript">
   <!--
    function sayHello() {
        //alert("Hello there");
        $.ajax({
                url: 'frmID.aspx',
                type: 'POST',
                data: JSON.stringify({
                    name: $('#name').val(),
                    surname: $('#surname').val()
                }),
                contentType: "application/json",
                dataType: 'json',
                success: function (json) {
                    if (json['error']) {
                        $('#alertinfo').html('<i class="fa fa-info-circle"></i>' + json['error']);
                    }
                    else if (json['success']) {
                        $('#id').val(json['success']);
                    }
                }
            });

        }
 //-->

if i remove comments from alert function it executes. I have tried using double quotes as "post" post in upper and lower case wrapped function inside $(document).ready(function () { } but $.ajax({... part fails to run.

Pls give some clue

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have a HTML comment in the tag. Remove <!-- or add a closing tag

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!