search
HomeBackend DevelopmentPHP Tutorial新帖续问:$.ajax()函数对于怎么利用返回值的一些细节有关问题

新帖续问:$.ajax()函数对于如何利用返回值的一些细节问题

引用 33 楼 anyilaoliu 的回复:
你以前是input的边框  现在input都被你替换掉了

有两个解决方案  一是直接把数值插入input的value中

二是还按现在的写  然后给td加边框让其看起来像之前的

给你写的td.html(xxx) 并不是一定要死板的这么写 你td里边有内容 就随之变化
————————————————————————————————————————————————————————————————————————————————
前面是热心人 anyilaoliu对我前一个问题的指导。随后,我又产生一些问题:(大家别介意,我是新手,我想扎扎实实把问题问清楚,这样此类问题就好办了)

1.在我前面问的问题中,我需要完成页面左边是记录列表,右边为记录的各个字段详细信息(基本上是以一列方框的形势存在),下面有一个save按钮,用来添加记录的。现在我想增加一个按钮,用来删除选中的记录。我的思路是:点击左边某记录,其内容会在右边显现出具体内容,此时点击删除按钮,则可以删除给记录。我在实现过程中遇到的困难是如何记录下给选中的记录的编号,我采用的方法是在$.ajax()指向ajax.php时,在ajax.php文件中采用session的方式记录下编号,然后再在点击删除按钮时启动另外一个文件,读取session,并查找数据库并删除。想的挺美的,程序就是认为session没有赋值。晕死,以前试过做过小东西,session是保留的最后一招,现在不行了。也不知道怎么回事情?

2.针对$.ajax()中所指定的ajax.php,把该文件返回的信息插入的value中,比如 
 
这个应该怎么操作呢?

3.前贴中说到, anyilaoliu说到“给你写的td.html(xxx) 并不是一定要死板的这么写 你td里边有内容 就随之变化”,意思其实是不仅td可以用,像

都可以这样用是么?是不是对于上述类型都是标注class="指定名称"即可呢?

4.还有,$.ajax()函数中采用$(".show_tr").text(..)的形式引用返回信息,但ajax中还有$.post()这个函数时,好像就写成$("#show_6").text(..),这两个.show_6和#show_6是不能混用的吧?我看到另外一个朋友,他就是到处用$.post(),我想知道这两个函数优劣,以及该使用哪个。

我这个恐怕是学习贴,欢迎各位指导啊。
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Email: Step-by-Step Sending GuidePHP Email: Step-by-Step Sending GuideMay 09, 2025 am 12:14 AM

PHPisusedforsendingemailsduetoitsintegrationwithservermailservicesandexternalSMTPproviders,automatingnotificationsandmarketingcampaigns.1)SetupyourPHPenvironmentwithawebserverandPHP,ensuringthemailfunctionisenabled.2)UseabasicscriptwithPHP'smailfunct

How to Send Email via PHP: Examples & CodeHow to Send Email via PHP: Examples & CodeMay 09, 2025 am 12:13 AM

The best way to send emails is to use the PHPMailer library. 1) Using the mail() function is simple but unreliable, which may cause emails to enter spam or cannot be delivered. 2) PHPMailer provides better control and reliability, and supports HTML mail, attachments and SMTP authentication. 3) Make sure SMTP settings are configured correctly and encryption (such as STARTTLS or SSL/TLS) is used to enhance security. 4) For large amounts of emails, consider using a mail queue system to optimize performance.

Advanced PHP Email: Custom Headers & FeaturesAdvanced PHP Email: Custom Headers & FeaturesMay 09, 2025 am 12:13 AM

CustomheadersandadvancedfeaturesinPHPemailenhancefunctionalityandreliability.1)Customheadersaddmetadatafortrackingandcategorization.2)HTMLemailsallowformattingandinteractivity.3)AttachmentscanbesentusinglibrarieslikePHPMailer.4)SMTPauthenticationimpr

Guide to Sending Emails with PHP & SMTPGuide to Sending Emails with PHP & SMTPMay 09, 2025 am 12:06 AM

Sending mail using PHP and SMTP can be achieved through the PHPMailer library. 1) Install and configure PHPMailer, 2) Set SMTP server details, 3) Define the email content, 4) Send emails and handle errors. Use this method to ensure the reliability and security of emails.

What is the best way to send an email using PHP?What is the best way to send an email using PHP?May 08, 2025 am 12:21 AM

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

Best Practices for Dependency Injection in PHPBest Practices for Dependency Injection in PHPMay 08, 2025 am 12:21 AM

The reason for using Dependency Injection (DI) is that it promotes loose coupling, testability, and maintainability of the code. 1) Use constructor to inject dependencies, 2) Avoid using service locators, 3) Use dependency injection containers to manage dependencies, 4) Improve testability through injecting dependencies, 5) Avoid over-injection dependencies, 6) Consider the impact of DI on performance.

PHP performance tuning tips and tricksPHP performance tuning tips and tricksMay 08, 2025 am 12:20 AM

PHPperformancetuningiscrucialbecauseitenhancesspeedandefficiency,whicharevitalforwebapplications.1)CachingwithAPCureducesdatabaseloadandimprovesresponsetimes.2)Optimizingdatabasequeriesbyselectingnecessarycolumnsandusingindexingspeedsupdataretrieval.

PHP Email Security: Best Practices for Sending EmailsPHP Email Security: Best Practices for Sending EmailsMay 08, 2025 am 12:16 AM

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version